Sort entries both on the backend and frontend

This commit is contained in:
2025-06-19 18:56:40 +02:00
parent 41c342bb0f
commit feadab4dff
2 changed files with 7 additions and 4 deletions

View File

@@ -34,10 +34,12 @@ export class EntriesOverviewService {
return combineLatest([this.cachedCars$!, entries$])
.pipe(
map(([cars, entries]) => {
return entries.map((entry): Consumption => ({
...entry,
car: cars.find(car => car.id === entry.carId)!
}));
return entries
.sort((a, b) => b.dateTime.localeCompare(a.dateTime))
.map((entry): Consumption => ({
...entry,
car: cars.find(car => car.id === entry.carId)!
}));
})
)
}