Sort fuel and maintenance log#184
Merged
javedh-dev merged 2 commits intojavedh-dev:devfrom Feb 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds proper sorting to fuel and maintenance logs to display entries in descending order by date with odometer as a secondary sort criterion. The changes address an issue where logs with the same date (stored without time component) were displayed in inconsistent order, and maintenance logs weren't sorted at all.
Changes:
- Added secondary sorting by odometer to fuel logs when dates are equal
- Added complete sorting logic to maintenance logs (date descending, then odometer descending)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/lib/stores/fuel-log.svelte.ts | Added secondary sort by odometer for same-date entries |
| src/lib/stores/maintenance.svelte.ts | Added complete sorting logic (date and odometer) where none existed before |
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.
First Change
When two fuel logs shared the same date (stored without time component), the secondary sort by odometer was missing, causing incorrect and inconsistent display order.
Second Change
Maintenance log wasn't sorted at all. That resulted in having the oldest entry first, where I would want to have the newest first. Also implemented the secondary sort after odometer.
Changes
fuel-log.svelte.ts: Added odometer as secondary sort criterionmaintenance.svelte.ts: Added date and odometer sorting (was missing entirely)Root Cause
Dates are stored with initialized timestamp, so compareDesc() returns 0 for same-day entries, leaving order undefined.