New Angular based web version #1
@@ -34,7 +34,9 @@ export class EntriesOverviewService {
|
||||
return combineLatest([this.cachedCars$!, entries$])
|
||||
.pipe(
|
||||
map(([cars, entries]) => {
|
||||
return entries.map((entry): Consumption => ({
|
||||
return entries
|
||||
.sort((a, b) => b.dateTime.localeCompare(a.dateTime))
|
||||
.map((entry): Consumption => ({
|
||||
...entry,
|
||||
car: cars.find(car => car.id === entry.carId)!
|
||||
}));
|
||||
|
||||
@@ -41,6 +41,7 @@ public static class GetConsumptions
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
List<ResponseDto> consumptions = await dbContext.Consumptions
|
||||
.OrderByDescending(x => x.DateTime)
|
||||
.Select(x =>
|
||||
new ResponseDto(x.Id.Value, x.DateTime, x.Distance, x.Amount, x.IgnoreInCalculation, x.CarId.Value))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user