From e59e33bc3b60b96b54f7303b0c4607039ac99fb8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-T0O5CDB\\DESK-555BD" Date: Tue, 12 Nov 2024 12:58:59 -0700 Subject: [PATCH] fix bug. --- Controllers/Vehicle/ReportController.cs | 15 ++++++++++++--- Models/Report/ReportParameter.cs | 8 +------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Controllers/Vehicle/ReportController.cs b/Controllers/Vehicle/ReportController.cs index 1fe6146..7bfe25e 100644 --- a/Controllers/Vehicle/ReportController.cs +++ b/Controllers/Vehicle/ReportController.cs @@ -107,7 +107,7 @@ namespace CarCareTracker.Controllers }).ToList(); if (invertedFuelMileageUnit) { - foreach(CostForVehicleByMonth monthMileage in monthlyMileageData) + foreach (CostForVehicleByMonth monthMileage in monthlyMileageData) { if (monthMileage.Cost != default) { @@ -115,7 +115,7 @@ namespace CarCareTracker.Controllers } } } - var mpgViewModel = new MPGForVehicleByMonth { + var mpgViewModel = new MPGForVehicleByMonth { CostData = monthlyMileageData, Unit = invertedFuelMileageUnit ? preferredFuelMileageUnit : fuelEconomyMileageUnit, SortedCostData = (userConfig.UseMPG || invertedFuelMileageUnit) ? monthlyMileageData.OrderByDescending(x => x.Cost).ToList() : monthlyMileageData.OrderBy(x => x.Cost).ToList() @@ -322,7 +322,16 @@ namespace CarCareTracker.Controllers } public IActionResult GetReportParameters() { - var viewModel = new ReportParameter(); + var viewModel = new ReportParameter() { + VisibleColumns = new List { + nameof(GenericReportModel.DataType), + nameof(GenericReportModel.Date), + nameof(GenericReportModel.Odometer), + nameof(GenericReportModel.Description), + nameof(GenericReportModel.Cost), + nameof(GenericReportModel.Notes) + } + }; //get all extra fields from service records, repairs, upgrades, and tax records. var recordTypes = new List() { 0, 1, 3, 4 }; var extraFields = new List(); diff --git a/Models/Report/ReportParameter.cs b/Models/Report/ReportParameter.cs index 513cb99..c7c2b4a 100644 --- a/Models/Report/ReportParameter.cs +++ b/Models/Report/ReportParameter.cs @@ -2,13 +2,7 @@ { public class ReportParameter { - public List VisibleColumns { get; set; } = new List() { - nameof(GenericReportModel.DataType), - nameof(GenericReportModel.Date), - nameof(GenericReportModel.Odometer), - nameof(GenericReportModel.Description), - nameof(GenericReportModel.Cost), - nameof(GenericReportModel.Notes) }; + public List VisibleColumns { get; set; } = new List(); public List ExtraFields { get; set; } = new List(); } }