Type int64
}
+func (a Activity) String() string {
+ return fmt.Sprintf("%s-%s %d", a.Start.Format("15:04:05"), a.End.Format("15:04:05"), a.Type)
+}
+
func (c *Client) SetActivities(ctx context.Context, activities []Activity, startOfDay time.Time) error {
dataStreamID := DataStreamID(&fitness.DataSource{
DataType: &fitness.DataType{
endTimeNanos := a.End.UnixNano()
for _, p := range res.Point {
- if p.StartTimeNanos == startTimeNanos &&
- p.EndTimeNanos == endTimeNanos &&
- p.Value[0].IntVal == a.Type {
+ if p.StartTimeNanos == startTimeNanos && p.EndTimeNanos == endTimeNanos && p.Value[0].IntVal == a.Type {
+ log.Debugf(ctx, "activity %s already stored in Google Fit", a)
continue Next
}
}
+ log.Debugf(ctx, "activity %s will be added to Google Fit", a)
dataPoints = append(dataPoints, &fitness.DataPoint{
DataTypeName: dataTypeNameActivitySegment,
StartTimeNanos: startTimeNanos,