-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
…ulation to base it on moving duration [fix dougfales#10]
…_duration enhancement
…file contains no time information (based on order) [fix dougfales#13]
82b1768
to
bc45253
Compare
@@ -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? |
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.
My preference is to invert this statement - if last_pt
. unless
es are difficult to reason about.
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.
You are right, I also prefer the if notation. I just keep the original one.
PR update with if instead of unless.
One minor nit, but this looks good overall. |
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. |
OK, will do. |
Enhance calculation of average speed (with usage of new moving_duration)
@doc75 Done, published |
@andrewhao It is working fine. Thanks a lot. |
Included in this PR:
Test added for all cases.