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

Enhance calculation of average speed (with usage of new moving_duration) #11

Merged
merged 7 commits into from
Aug 4, 2015

Conversation

doc75
Copy link
Contributor

@doc75 doc75 commented Aug 1, 2015

Included in this PR:

  • The calculation of average speed now relies on the moving_duration (duration of all tracks without pause between segments). This fix the issue Change track duration calculation #10
  • Fix a broken test on Windows (very small diff on float value).
  • Add the management of track comment and description.
  • Ensure earliest_point and latest_point of segment are set enven if gpx file contains no time information

Test added for all cases.

@doc75 doc75 force-pushed the dev_moving_duration branch from 82b1768 to bc45253 Compare August 1, 2015 17:18
@@ -69,7 +75,10 @@ def append_point(pt)
@bounds.min_lon = pt.lon if pt.lon < @bounds.min_lon
@bounds.max_lat = pt.lat if pt.lat > @bounds.max_lat
@bounds.max_lon = pt.lon if pt.lon > @bounds.max_lon
@distance += haversine_distance(last_pt, pt) unless last_pt.nil?
unless last_pt.nil?
Copy link
Collaborator

Choose a reason for hiding this comment

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

My preference is to invert this statement - if last_pt. unlesses are difficult to reason about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, I also prefer the if notation. I just keep the original one.
PR update with if instead of unless.

@andrewhao
Copy link
Collaborator

One minor nit, but this looks good overall.

@doc75
Copy link
Contributor Author

doc75 commented Aug 2, 2015

If you could also bump version and publish it, that would be great (I did not change the version as I am not sure how you want to version it.

@andrewhao
Copy link
Collaborator

OK, will do.

@andrewhao andrewhao closed this Aug 4, 2015
@andrewhao andrewhao reopened this Aug 4, 2015
andrewhao added a commit that referenced this pull request Aug 4, 2015
Enhance calculation of average speed (with usage of new moving_duration)
@andrewhao andrewhao merged commit 46fd2fa into dougfales:master Aug 4, 2015
@andrewhao
Copy link
Collaborator

@doc75 Done, published v0.8.2. Let me know if this works for you.

@doc75 doc75 deleted the dev_moving_duration branch August 4, 2015 16:24
@doc75
Copy link
Contributor Author

doc75 commented Aug 4, 2015

@andrewhao It is working fine. Thanks a lot.

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.

2 participants