Skip to content

More info in Milleage data#201

Open
MARMdeveloper wants to merge 2 commits intomainfrom
feat/more-info-in-milleage-stats
Open

More info in Milleage data#201
MARMdeveloper wants to merge 2 commits intomainfrom
feat/more-info-in-milleage-stats

Conversation

@MARMdeveloper
Copy link
Collaborator

Summary

Closes #187

Adds energy cost, total energy consumption and average efficiency (Wh/km) to all levels of the Mileage screen (lifetime, year, month, day). Also improves layout, unit consistency and formatting throughout the screen.

Changes

Data layer

  • Load all charges in parallel with drives in loadAllDrives() using async/await
  • Calculate energy cost per year/month/day in-memory from allCharges, same pattern as distance and energy — no Room queries needed
  • Add totalEnergyCost: Double? to YearlyMileage, MonthlyMileage and DailyMileage

ViewModel

  • Add totalLifetimeEnergy, avgLifetimeEnergyDistance and totalLifetimeEnergyCost to MileageUiState
  • Add yearTotalEnergy, avgYearEnergyDistance and yearTotalEnergyCost to MileageUiState
  • Add currencySymbol and units to MileageUiState, loaded from SettingsDataStore and car status

UI

  • SummaryRow: add second row showing average efficiency, total cost and total energy
  • YearRow / MonthRow: add second line with cost and efficiency, reorganized into two aligned columns — distance and cost on the left, drive count and efficiency on the right
  • MonthSummaryCard / DaySummaryCard: add third stat row with total energy and cost; replace average energy (kWh/drive) with average efficiency (Wh/km)
  • Use UnitFormatter.formatEfficiency() for efficiency values (respects imperial units)
  • Use currencySymbol from settings instead of hardcoded

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.

More info in Milleage pages

1 participant