From 31c1202649d69484693c3d067c7f149c6f7adbf7 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GENO133\\IvanPlex" Date: Thu, 25 Jan 2024 22:18:33 -0700 Subject: [PATCH] include partial fuel up fuel consumption in average mpg. --- Helper/GasHelper.cs | 5 +++-- Views/Home/_Settings.cshtml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Helper/GasHelper.cs b/Helper/GasHelper.cs index 2d12758..c6cd767 100644 --- a/Helper/GasHelper.cs +++ b/Helper/GasHelper.cs @@ -11,12 +11,13 @@ namespace CarCareTracker.Helper { public string GetAverageGasMileage(List results, bool useMPG) { - var recordWithCalculatedMPG = results.Where(x => x.MilesPerGallon > 0); + var recordsToCalculateGallons = results.Where(x => x.MilesPerGallon > 0 || !x.IsFillToFull); + var recordWithCalculatedMPG = recordsToCalculateGallons.Where(x => x.MilesPerGallon > 0); var minMileage = results.Min(x => x.Mileage); if (recordWithCalculatedMPG.Any()) { var maxMileage = recordWithCalculatedMPG.Max(x => x.Mileage); - var totalGallonsConsumed = recordWithCalculatedMPG.Sum(x => x.Gallons); + var totalGallonsConsumed = recordsToCalculateGallons.Sum(x => x.Gallons); var deltaMileage = maxMileage - minMileage; var averageGasMileage = (maxMileage - minMileage) / totalGallonsConsumed; if (!useMPG) diff --git a/Views/Home/_Settings.cshtml b/Views/Home/_Settings.cshtml index 149570b..c8dfea4 100644 --- a/Views/Home/_Settings.cshtml +++ b/Views/Home/_Settings.cshtml @@ -154,7 +154,7 @@
- Version 1.0.8 + Version 1.0.9

Proudly developed in the rural town of Price, Utah by Hargata Softworks.