JSON does not support NaN data points.
import (
"context"
"fmt"
- "math"
"net/http"
"strings"
"time"
break
}
+ average := float64(d.Min+d.Max) / 2.0
+ if d.Min <= restingHeartRate && restingHeartRate <= d.Max {
+ average = float64(restingHeartRate)
+ }
+
dataPoints = append(dataPoints, &fitness.DataPoint{
DataTypeName: dataSource.DataType.Name,
StartTimeNanos: startTime.UnixNano(),
EndTimeNanos: endTime.UnixNano(),
Value: []*fitness.Value{
&fitness.Value{
- FpVal: math.NaN(),
+ FpVal: average,
},
&fitness.Value{
FpVal: float64(d.Max),