Skip to content

Commit

Permalink
fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
hargata committed Nov 12, 2024
1 parent a671dc1 commit e59e33b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
15 changes: 12 additions & 3 deletions Controllers/Vehicle/ReportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ public IActionResult GetReportPartialView(int vehicleId)
}).ToList();
if (invertedFuelMileageUnit)
{
foreach(CostForVehicleByMonth monthMileage in monthlyMileageData)
foreach (CostForVehicleByMonth monthMileage in monthlyMileageData)
{
if (monthMileage.Cost != default)
{
monthMileage.Cost = 100 / monthMileage.Cost;
}
}
}
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()
Expand Down Expand Up @@ -322,7 +322,16 @@ public IActionResult GetVehicleAttachments(int vehicleId, List<ImportMode> expor
}
public IActionResult GetReportParameters()
{
var viewModel = new ReportParameter();
var viewModel = new ReportParameter() {
VisibleColumns = new List<string> {
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<int>() { 0, 1, 3, 4 };
var extraFields = new List<string>();
Expand Down
8 changes: 1 addition & 7 deletions Models/Report/ReportParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
{
public class ReportParameter
{
public List<string> VisibleColumns { get; set; } = new List<string>() {
nameof(GenericReportModel.DataType),
nameof(GenericReportModel.Date),
nameof(GenericReportModel.Odometer),
nameof(GenericReportModel.Description),
nameof(GenericReportModel.Cost),
nameof(GenericReportModel.Notes) };
public List<string> VisibleColumns { get; set; } = new List<string>();
public List<string> ExtraFields { get; set; } = new List<string>();
}
}

0 comments on commit e59e33b

Please sign in to comment.