wg.Done()
}()
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+
+ var activities []gfit.Activity
+ for _, a := range summary.Activities {
+ if !a.HasStartTime {
+ continue
+ }
+
+ startTime, err := time.ParseInLocation("2006-01-02T15:04:05", a.StartDate+"T"+a.StartTime, profile.Timezone)
+ if err != nil {
+ errs = append(errs, fmt.Errorf("gfitClient.SetActivities() = %v", err))
+ return
+ }
+ endTime := startTime.Add(time.Duration(a.Duration) * time.Millisecond)
+
+ activities = append(activities, gfit.Activity{
+ Start: startTime,
+ End: endTime,
+ Type: gfit.ParseFitbitActivity(a.Name),
+ })
+ }
+ if err := gfitClient.SetActivities(ctx, activities, tm); err != nil {
+ errs = append(errs, fmt.Errorf("gfitClient.SetActivities() = %v", err))
+ return
+ }
+ }()
+
wg.Wait()
if len(errs) != 0 {