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

Correct gap in efficency.json for mi only. #672

Merged
merged 2 commits into from
May 3, 2020
Merged

Correct gap in efficency.json for mi only. #672

merged 2 commits into from
May 3, 2020

Conversation

Dulanic
Copy link
Collaborator

@Dulanic Dulanic commented May 2, 2020

Updated distance to convert_km(distance, '$length_unit') to correct gap in original SQL which wasn't converting the distance and only the min distance.

Fixes #671

Updated distance to convert_km(distance, '$length_unit') to correct gap in original SQL which wasnt converting the distance and only the min distance.
@Dulanic Dulanic changed the title Update efficiency.json Correct gap in efficency.json for mi only. May 2, 2020
@dyxyl
Copy link
Contributor

dyxyl commented May 2, 2020

I think your patch is wrong: convert_km(distance, '$length_unit') >= convert_km($min_distance, '$length_unit') is just a slower equivalent to distance >= $min_distance. The distance column is always in km, but the $min_distance parameter comes from the user, so I think TeslaMate should assume it is in the user's configured units.

Therefore the test should be convert_km(distance, '$length_unit') >= $min_distance.

The function convert_km has a confusing name and should be called something like convert_distance_from_km_to_unit.

@Dulanic
Copy link
Collaborator Author

Dulanic commented May 2, 2020

Agreed, will fix. It just needs the conversion removed from the filter. I know the function name is slightly confusing, but I know what it does :)

Removed convert from filter
Copy link
Collaborator

@adriankumpf adriankumpf left a comment

Choose a reason for hiding this comment

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

👍

@adriankumpf adriankumpf merged commit fdc6543 into teslamate-org:master May 3, 2020
@Dulanic Dulanic deleted the patch-5 branch May 3, 2020 16:47
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.

"min. distance per drive" on Efficiency doesn't filter correctly in miles
3 participants