Fixed a bunch of minor stuff, styling and average mpg calculation.

This commit is contained in:
DESKTOP-GENO133\IvanPlex
2024-01-20 14:30:07 -07:00
parent 9a7f2233a0
commit 0c93663e51
9 changed files with 41 additions and 8 deletions

View File

@@ -914,11 +914,11 @@ namespace CarCareTracker.Controllers
bool useUKMPG = _config.GetUserConfig(User).UseUKMPG;
vehicleHistory.TotalGasCost = gasRecords.Sum(x => x.Cost);
vehicleHistory.TotalCost = serviceRecords.Sum(x => x.Cost) + repairRecords.Sum(x => x.Cost) + upgradeRecords.Sum(x => x.Cost) + taxRecords.Sum(x => x.Cost);
var averageMPG = 0.00M;
var averageMPG = "0";
var gasViewModels = _gasHelper.GetGasRecordViewModels(gasRecords, useMPG, useUKMPG);
if (gasViewModels.Any())
{
averageMPG = gasViewModels.Average(x => x.MilesPerGallon);
averageMPG = _gasHelper.GetAverageGasMileage(gasViewModels);
}
vehicleHistory.MPG = averageMPG;
//insert servicerecords