diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index f31c3eb..4f05188 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -235,7 +235,15 @@ namespace CarCareTracker.Controllers bool useUKMPG = _config.GetUserConfig(User).UseUKMPG; vehicleRecords = vehicleRecords.OrderBy(x => x.Date).ThenBy(x => x.Mileage).ToList(); var convertedRecords = _gasHelper.GetGasRecordViewModels(vehicleRecords, useMPG, useUKMPG); - var exportData = convertedRecords.Select(x => new GasRecordExportModel { Date = x.Date.ToString(), Cost = x.Cost.ToString(), FuelConsumed = x.Gallons.ToString(), FuelEconomy = x.MilesPerGallon.ToString(), Odometer = x.Mileage.ToString() }); + var exportData = convertedRecords.Select(x => new GasRecordExportModel { + Date = x.Date.ToString(), + Cost = x.Cost.ToString(), + FuelConsumed = x.Gallons.ToString(), + FuelEconomy = x.MilesPerGallon.ToString(), + Odometer = x.Mileage.ToString(), + IsFillToFull = x.IsFillToFull.ToString(), + MissedFuelUp = x.MissedFuelUp.ToString() + }); using (var writer = new StreamWriter(fullExportFilePath)) { using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)) @@ -302,12 +310,14 @@ namespace CarCareTracker.Controllers convertedRecord.IsFillToFull = !parsedBool; } else if (!string.IsNullOrWhiteSpace(importModel.IsFillToFull)) { - var parsedBool = importModel.IsFillToFull.Trim() == "1" || importModel.IsFillToFull.Trim() == "Full"; + var possibleFillToFullValues = new List { "1", "true", "full" }; + var parsedBool = possibleFillToFullValues.Contains(importModel.IsFillToFull.Trim().ToLower()); convertedRecord.IsFillToFull = parsedBool; } if (!string.IsNullOrWhiteSpace(importModel.MissedFuelUp)) { - var parsedBool = importModel.MissedFuelUp.Trim() == "1"; + var possibleMissedFuelUpValues = new List { "1", "true" }; + var parsedBool = possibleMissedFuelUpValues.Contains(importModel.MissedFuelUp.Trim().ToLower()); convertedRecord.MissedFuelUp = parsedBool; } //insert record into db, check to make sure fuelconsumed is not zero so we don't get a divide by zero error. diff --git a/Helper/GasHelper.cs b/Helper/GasHelper.cs index 9172552..b3a9a44 100644 --- a/Helper/GasHelper.cs +++ b/Helper/GasHelper.cs @@ -42,7 +42,9 @@ namespace CarCareTracker.Helper Gallons = convertedConsumption, Cost = currentObject.Cost, DeltaMileage = deltaMileage, - CostPerGallon = currentObject.Cost / convertedConsumption + CostPerGallon = currentObject.Cost / convertedConsumption, + IsFillToFull = currentObject.IsFillToFull, + MissedFuelUp = currentObject.MissedFuelUp }; if (currentObject.MissedFuelUp) { @@ -81,7 +83,9 @@ namespace CarCareTracker.Helper Cost = currentObject.Cost, DeltaMileage = 0, MilesPerGallon = 0, - CostPerGallon = currentObject.Cost / convertedConsumption + CostPerGallon = currentObject.Cost / convertedConsumption, + IsFillToFull = currentObject.IsFillToFull, + MissedFuelUp = currentObject.MissedFuelUp }); } previousMileage = currentObject.Mileage; diff --git a/MapProfile/FuellyMappers.cs b/MapProfile/FuellyMappers.cs index 8f3ed5e..33c13e7 100644 --- a/MapProfile/FuellyMappers.cs +++ b/MapProfile/FuellyMappers.cs @@ -16,7 +16,7 @@ namespace CarCareTracker.MapProfile Map(m => m.PartialFuelUp).Name(["partial_fuelup"]); Map(m => m.IsFillToFull).Name(["isfilltofull", "filled up"]); Map(m => m.Description).Name(["description"]); - Map(m => m.MissedFuelUp).Name(["missed_fuelup"]); + Map(m => m.MissedFuelUp).Name(["missed_fuelup", "missedfuelup"]); } } } diff --git a/Models/GasRecord/GasRecordViewModel.cs b/Models/GasRecord/GasRecordViewModel.cs index e790af0..8979c8d 100644 --- a/Models/GasRecord/GasRecordViewModel.cs +++ b/Models/GasRecord/GasRecordViewModel.cs @@ -18,5 +18,7 @@ public int DeltaMileage { get; set; } public decimal MilesPerGallon { get; set; } public decimal CostPerGallon { get; set; } + public bool IsFillToFull { get; set; } + public bool MissedFuelUp { get; set; } } } diff --git a/Models/ImportModel.cs b/Models/ImportModel.cs index e9ae7e7..71281ca 100644 --- a/Models/ImportModel.cs +++ b/Models/ImportModel.cs @@ -40,6 +40,8 @@ public string FuelConsumed { get; set; } public string Cost { get; set; } public string FuelEconomy { get; set; } + public string IsFillToFull { get; set; } + public string MissedFuelUp { get; set; } } public class ReminderExportModel { diff --git a/wwwroot/css/site.css b/wwwroot/css/site.css index c06850c..fdd75c5 100644 --- a/wwwroot/css/site.css +++ b/wwwroot/css/site.css @@ -231,3 +231,7 @@ html { display: none; } } + +.dropdown-menu.show{ + z-index: 1030; +} \ No newline at end of file