Add UK MPG fuel consumption unit#197
Merged
javedh-dev merged 2 commits intojavedh-dev:devfrom Mar 27, 2026
Merged
Conversation
javedh-dev
reviewed
Mar 26, 2026
Owner
There was a problem hiding this comment.
@jake-walker MPG - stands for miles per gallon. and for this UK has distance as miles and fuel volume in litres. Is this a correct understanding?
Contributor
Author
|
@javedh-dev that's correct yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a "UK MPG" option to the mileage selection. As mentioned in #66, in the UK, we have a strange mix of measuring petrol volume in litres, distance as miles and fuel consumption as miles/gallon. With Tracktor currently, if I use litres and miles for my units, I can only choose between mi/L and L/100mi.
Why a dedicated UK option?
In the GitHub issue, someone raised the very valid point of it being strange to have a dedicated "UK" option. According to AI, the UK is the only place with a strange mix of units like this, so I felt like this is the best solution.
The other option was to implement individual units that are independent from what the volume and distance units are set to. I felt like this would have added a lot of complexity to the calculations, especially given the two options already in Tracktor are fine for most users. For context, the following units (and conversions for each) would have needed to be implemented:
List of fuel consumption units
Changes
uk-mpgoption formileageUnitFormat.distance-per-fuelformat if, for example, you haduk-mpgselected but units don't match.Screenshots
Valid settings:
Invalid settings (distance must be miles):
Fuel log with new unit:
I do get this approach with the dedicated "UK" option is a little opinionated, but hopefully my reasoning above explains why the other approach was a little more messy. Hopefully that makes sense, but I'm happy to make any changes with suggestions or explain further if needed :)