-
Notifications
You must be signed in to change notification settings - Fork 11
Support manual entries which GPS data is in a Route #14
base: master
Are you sure you want to change the base?
Conversation
Get route name and GPS data for associated activity. Add route info as description in GPX. Use Runtastic activity notes as GPX name if available. Use starting time in filename instead of created time (can be different for manual entries). Fix extra trimmed GPX tag (type).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I've added a couple of comments.
type | ||
? ` | ||
<type>${type}</type> | ||
`.trim() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to keep them trimmed to prevent empty lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but that also removes the starting new line, and the <type>
tag ends up on the same line as the previous tag.
I actually just "manually trimmed" the line by removing the trailing new line : end of string character is just after the closing tag </type>
instead of being on the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense now, thanks!
@@ -209,7 +217,7 @@ const template = (data, name) => { | |||
}; | |||
|
|||
const fileName = (data, name) => { | |||
const createdDate = new Date(data.created_at); | |||
const createdDate = new Date(data.start_time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break at other activities. Can we do it in a way to handle both created_at
& start_time
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a condition on the start_time
variable, but I don't see how it will break for other activities.
It seems that start_time
exists in all session files, with/without live tracking, with/without GPS path. For live tracked sessions, created_at
and start_time
have the same value.
In addition, it's already used in your code : https://github.com/glennreyes/runtastic-gpx/blob/master/index.js#L116
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do created_at || start_time
here since we cannot assume that start_time will always equal the created date. So we fallback to start_time
if the creation date doesn't exist.
type | ||
? ` | ||
<type>${type}</type> | ||
`.trim() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense now, thanks!
Hi,
Thanks for the converter !
I added the GPX conversion of Runtastic activities with no live tracking and for which the GPS data is stored in a separate Route file.
All details are in the commit.
I manually add start and end timestamps to the first and last GPS points, but there are no time points in between.