Conversation
added 2 commits
August 25, 2026 00:44
…282) Issue #323 made tracking_unit authoritative for the consumption and running-cost maths but left two gaps, and both are what the reporter of #282 actually runs into. A maintenance schedule could only state a reading-based interval in kilometres or miles, and calculate_next_due ran that interval through the km/mi conversion before adding it to a reading that was in engine hours, so a tractor could never be serviced to anything sensible. Schedules gain interval_hours, added untouched for such a vehicle; a stray distance interval on one is ignored rather than misread. "Due soon" for it means within 25 engine hours, not 500, which had put every such service permanently in the amber. The form hides the km and miles boxes for an hours vehicle and shows them again for any other, rendered server-side so it is right before any script runs. Readings on an hours-tracked vehicle and the figures derived from them are now labelled in hours — "h", "L / h", "Cost per h", "kWh / 100 h", and "Engine hours" rather than "Odometer" — across fuel, expenses, notes, tyres, mileage allowance, the vehicle page, the maintenance list, the calendar feed and the PDF report. The maintenance list also took its unit from the account's distance preference, which was wrong for any vehicle whose own odometer unit differed from it. The trip and charging forms still label the reading with the account's distance unit, as they do for every vehicle, and are unchanged here.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (39)
📒 Files selected for processing (25)
📝 WalkthroughWalkthroughThe change adds engine-hour maintenance schedules, tracking-specific intervals and due-soon thresholds. Vehicle reading, span, and consumption labels now use vehicle-specific units across forms, lists, reports, and vehicle views. ChangesEngine-hour maintenance
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Driver
participant MaintenanceForm
participant MaintenanceRoutes
participant MaintenanceSchedule
participant Database
Driver->>MaintenanceForm: Select vehicle and interval type
MaintenanceForm->>MaintenanceRoutes: Submit interval_hours or distance interval
MaintenanceRoutes->>MaintenanceSchedule: Create or update schedule
MaintenanceSchedule->>Database: Store maintenance interval
MaintenanceSchedule->>MaintenanceForm: Calculate labels and due reading
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
0.39.0
Vehicles metered in engine hours — tractors, generators, plant — are now serviced and labelled in hours rather than in distance.
Features
Fixes
Other
interval_hourscolumn on maintenance schedules (migrationf2a3b4c5d6e7, applied automatically on start-up); it is carried through backup and restore.Thanks to the reporter of #282 for the detail on how hour-metered machinery is actually serviced.
Known limitations
The trip and charging forms, and the timeline on the vehicle page, still label a reading with the account's distance unit, as they do for every vehicle.
Summary by CodeRabbit
New Features
Documentation