Skip to content

Sort fuel and maintenance log#184

Merged
javedh-dev merged 2 commits intojavedh-dev:devfrom
DesignerThan95:feature/sort-fuel-and-maintenance-log
Feb 19, 2026
Merged

Sort fuel and maintenance log#184
javedh-dev merged 2 commits intojavedh-dev:devfrom
DesignerThan95:feature/sort-fuel-and-maintenance-log

Conversation

@DesignerThan95
Copy link
Contributor

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 criterion
  • maintenance.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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@javedh-dev javedh-dev merged commit c57b23f into javedh-dev:dev Feb 19, 2026
7 checks passed
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

Comments