Skip to content

Commit

Permalink
Add notes, fix timezone
Browse files Browse the repository at this point in the history
Mapped the Nike+ note to Runkeeper's note.

Nike+ activities are in UTC, whereas Runkeeper wants them in local
time; this was resulting in Runkeeper run start times being off by
several hours (since I'm at -5:00 UTC).  Hack around this by
subtracting the local gmt offset.  It would be better to calculate the
gmt offset of the gps location, but this is good enough for me.
  • Loading branch information
arolson101 authored and aron committed Mar 12, 2015
1 parent 21414d8 commit 46cadb3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app.rb
Expand Up @@ -89,14 +89,18 @@ def signed_in?

runkeeper_activity = {
type: 'Running',
start_time: nike_activity.start_time_utc,
start_time: nike_activity.start_time_utc + nike_activity.start_time_utc.gmt_offset, # hack: adjust time by gmt_offset to get in local time, which is what Runkeeper wants
total_distance: nike_activity.distance * 1000,
duration: duration,
detect_pauses: true,
total_calories: nike_activity.calories.to_f,
average_heart_rate: nike_activity.average_heart_rate.to_f
average_heart_rate: nike_activity.average_heart_rate.to_f,
}

if nike_activity.tags.note
runkeeper_activity.notes = nike_activity.tags.note
end

if a.gps && nike_activity.geo && nike_activity.geo.waypoints
index = -1
total = nike_activity.geo.waypoints.size
Expand Down

0 comments on commit 46cadb3

Please sign in to comment.