Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

Support manual entries which GPS data is in a Route #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adrienkaiser
Copy link

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.

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).
Copy link
Owner

@glennreyes glennreyes left a 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()
Copy link
Owner

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?

Copy link
Author

@adrienkaiser adrienkaiser Sep 11, 2019

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.

Copy link
Owner

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);
Copy link
Owner

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?

Copy link
Author

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

Copy link
Owner

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.

@glennreyes glennreyes requested a review from mipapo September 10, 2019 18:52
type
? `
<type>${type}</type>
`.trim()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense now, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants