Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPX file support. Use attributes for magic numbers. #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

heleon19
Copy link

I've added a new dependencie to gpx-parse, but I'm not sure if the version is ok. First time I use github and npm package manager. Hoppe you can use some of the modifications.

@alvarolorentedev
Copy link
Owner

i will check the PR asap, thanks :)

@alvarolorentedev
Copy link
Owner

i need a bit more of info on what fix is doing, do you mind give me a small comment on it?

lib/workout.js Outdated
var qs = postQueryString(params)
var url = apiUrl + paths.activity.post

request.post({ url: url, qs: qs }, (err, response, body) => {
if (err || !regex.isOk.test(body))
{
console.log(body);
Copy link
Owner

Choose a reason for hiding this comment

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

this debug line should be removed

Copy link
Author

Choose a reason for hiding this comment

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

That's true, have removed it in my branch.

sportAttr = attributes.sport,
trackAttr = attributes.track

var EARTH_RADIUS_KM = 6371.0;
Copy link
Owner

Choose a reason for hiding this comment

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

This file contains quite a bit of logic, that i am sure its already done by some package (i think i have used in a different project. If you want we can talk about it or i can look at it to refactor on the future

Copy link
Author

Choose a reason for hiding this comment

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

It's ok for me to not include this file. There might be packages to get the distance of two coordinates.

@heleon19
Copy link
Author

The important changes are in workout.js starting at line 59.

It's not always necessary to send distance and speed, therefore it must be possible leave it empty.

(workoutPoint.latitude ? workoutPoint.latitude.toFixed(8) : '') + ';' +
(workoutPoint.longitude ? workoutPoint.longitude.toFixed(8) : '') + ';' +
(workoutPoint.distance ? workoutPoint.distance.toFixed(3) : '') + ';' +
(workoutPoint.speed ? workoutPoint.speed.toFixed(3) : '') + ';' +
(workoutPoint.altitude ? workoutPoint.altitude.toFixed(3) : '') + ';' +

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

Successfully merging this pull request may close these issues.

None yet

2 participants