From 928d18c8e5d39dd7811cbdfd766a9348c95ff531 Mon Sep 17 00:00:00 2001 From: ivancheahhh Date: Wed, 3 Jan 2024 05:37:05 -0700 Subject: [PATCH] better sizing for note text area. --- Controllers/VehicleController.cs | 7 ++++--- Views/Vehicle/Index.cshtml | 6 ++---- Views/Vehicle/_Gas.cshtml | 12 ++++++------ Views/Vehicle/_GasModal.cshtml | 8 ++++---- Views/Vehicle/_ServiceRecordModal.cshtml | 4 ++-- wwwroot/css/site.css | 4 ++++ wwwroot/js/servicerecord.js | 2 +- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index b1b1089..995307f 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -78,14 +78,14 @@ namespace CarCareTracker.Controllers { var result = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId); var computedResults = new List(); + int previousMileage = 0; //perform computation. for(int i = 0; i < result.Count; i++) { if (i > 0) { var currentObject = result[i]; - var previousObject = result[i - 1]; - var deltaMileage = currentObject.Mileage - previousObject.Mileage; + var deltaMileage = currentObject.Mileage - previousMileage; computedResults.Add(new GasRecordViewModel() { Id = currentObject.Id, @@ -113,8 +113,9 @@ namespace CarCareTracker.Controllers CostPerGallon = (result[i].Cost / result[i].Gallons) }); } + previousMileage = result[i].Mileage; } - return PartialView("_GasRecords", result); + return PartialView("_GasRecords", computedResults); } #endregion #region "Service Records" diff --git a/Views/Vehicle/Index.cshtml b/Views/Vehicle/Index.cshtml index 4d8ba07..93f37e9 100644 --- a/Views/Vehicle/Index.cshtml +++ b/Views/Vehicle/Index.cshtml @@ -39,16 +39,14 @@
-
- -
+
111
222
- +
diff --git a/Views/Vehicle/_Gas.cshtml b/Views/Vehicle/_Gas.cshtml index 9b6e32d..652cc10 100644 --- a/Views/Vehicle/_Gas.cshtml +++ b/Views/Vehicle/_Gas.cshtml @@ -3,9 +3,9 @@
@($"# of Gas Records: {Model.Count()}") - @($"Average MPG: {Model.Where(y=>y.MilesPerGallon > 0).Average(x => x.MilesPerGallon)}") - @($"Min MPG: {Model.Min(x => x.MilesPerGallon)}") - @($"Max MPG: {Model.Max(x => x.MilesPerGallon)}") + @($"Average Fuel Economy: {Model.Where(y=>y.MilesPerGallon > 0).Average(x => x.MilesPerGallon)}") + @($"Min Fuel Economy: {Model.Min(x => x.MilesPerGallon)}") + @($"Max Fuel Economy: {Model.Max(x => x.MilesPerGallon)}") @($"Total Gallons: {Model.Sum(x=>x.Gallons)}") @($"Total Cost: {Model.Sum(x => x.Cost).ToString("C")}")
@@ -20,9 +20,9 @@ Date Refueled - Mileage - Gallons - MPG + Odometer + Consumption + Fuel Economy Cost Unit Cost diff --git a/Views/Vehicle/_GasModal.cshtml b/Views/Vehicle/_GasModal.cshtml index 50f05ab..e68b7bc 100644 --- a/Views/Vehicle/_GasModal.cshtml +++ b/Views/Vehicle/_GasModal.cshtml @@ -14,9 +14,9 @@
- + - + @@ -34,13 +34,13 @@
} - +
} else { - + }
diff --git a/Views/Vehicle/_ServiceRecordModal.cshtml b/Views/Vehicle/_ServiceRecordModal.cshtml index 7e37a24..66189cc 100644 --- a/Views/Vehicle/_ServiceRecordModal.cshtml +++ b/Views/Vehicle/_ServiceRecordModal.cshtml @@ -36,13 +36,13 @@ } - + } else { - + } diff --git a/wwwroot/css/site.css b/wwwroot/css/site.css index 25cb781..fe70ebd 100644 --- a/wwwroot/css/site.css +++ b/wwwroot/css/site.css @@ -34,4 +34,8 @@ html { max-height:65vh; overflow-y:auto; overflow-x:auto; +} + +.vehicleNoteContainer{ + height:40vh; } \ No newline at end of file diff --git a/wwwroot/js/servicerecord.js b/wwwroot/js/servicerecord.js index dd0554b..b3bfa7c 100644 --- a/wwwroot/js/servicerecord.js +++ b/wwwroot/js/servicerecord.js @@ -69,7 +69,7 @@ function saveServiceRecordToVehicle(isEdit) { } }) } -function uploadServiceRecordFilesAsync(event) { +function uploadVehicleFilesAsync(event) { let formData = new FormData(); var files = event.files; for (var x = 0; x < files.length; x++) {