return err
}
- tm, err := time.Parse("2006-01-02", s.Date)
+ fitbitClient, err := fitbit.NewClient(ctx, s.OwnerID, u)
if err != nil {
return err
}
- fitbitClient, err := fitbit.NewClient(ctx, s.OwnerID, u)
+ profile, err := fitbitClient.Profile(ctx)
+ if err != nil {
+ return err
+ }
+ log.Debugf(ctx, "profile = %+v", profile)
+
+ tm, err := time.ParseInLocation("2006-01-02", s.Date, profile.Timezone)
if err != nil {
return err
}
if err != nil {
return err
}
- log.Debugf(ctx, "ActivitySummary for %s = %+v", u.Email, summary)
+ log.Debugf(ctx, "%s (%s) took %d steps on %s",
+ profile.Name, u.Email, summary.Summary.Steps, s.Date)
gfitClient, err := gfit.NewClient(ctx, u)
if err != nil {
return fmt.Errorf("gfitClient.SetSteps(%d) = %v", summary.Summary.Steps, err)
}
+ if err := gfitClient.SetCalories(ctx, summary.Summary.CaloriesOut, tm); err != nil {
+ return fmt.Errorf("gfitClient.SetCalories(%d) = %v", summary.Summary.CaloriesOut, err)
+ }
+
return nil
}