diff --git a/Helper/ConfigHelper.cs b/Helper/ConfigHelper.cs
index 830e6c6..5a57555 100644
--- a/Helper/ConfigHelper.cs
+++ b/Helper/ConfigHelper.cs
@@ -93,7 +93,8 @@ namespace CarCareTracker.Helper
UseDescending = bool.Parse(_config[nameof(UserConfig.UseDescending)]),
EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]),
HideZero = bool.Parse(_config[nameof(UserConfig.HideZero)]),
- UseUKMPG = bool.Parse(_config[nameof(UserConfig.UseUKMPG)])
+ UseUKMPG = bool.Parse(_config[nameof(UserConfig.UseUKMPG)]),
+ UseThreeDecimalGasCost = bool.Parse(_config[nameof(UserConfig.UseThreeDecimalGasCost)])
};
int userId = 0;
if (user != null)
diff --git a/Models/UserConfig.cs b/Models/UserConfig.cs
index b3fba51..376ea56 100644
--- a/Models/UserConfig.cs
+++ b/Models/UserConfig.cs
@@ -9,6 +9,7 @@
public bool EnableAuth { get; set; }
public bool HideZero { get; set; }
public bool UseUKMPG {get;set;}
+ public bool UseThreeDecimalGasCost { get; set; }
public string UserNameHash { get; set; }
public string UserPasswordHash { get; set;}
}
diff --git a/Views/Home/_Settings.cshtml b/Views/Home/_Settings.cshtml
index 76b3070..cd402b7 100644
--- a/Views/Home/_Settings.cshtml
+++ b/Views/Home/_Settings.cshtml
@@ -32,6 +32,10 @@
+
+
+
+
@if (User.IsInRole(nameof(UserData.IsRootUser)))
{
@@ -89,7 +93,8 @@
useMPG: $("#useMPG").is(':checked'),
useDescending: $("#useDescending").is(':checked'),
hideZero: $("#hideZero").is(":checked"),
- useUKMpg: $("#useUKMPG").is(":checked")
+ useUKMpg: $("#useUKMPG").is(":checked"),
+ useThreeDecimalGasCost: $("#useThreeDecimal").is(":checked")
}
$.post('/Home/WriteToSettings', { userConfig: userConfigObject}, function(data){
if (data) {
diff --git a/Views/Vehicle/_Gas.cshtml b/Views/Vehicle/_Gas.cshtml
index 9d0eec3..5c52ffa 100644
--- a/Views/Vehicle/_Gas.cshtml
+++ b/Views/Vehicle/_Gas.cshtml
@@ -6,6 +6,8 @@
var useMPG = config.GetUserConfig(User).UseMPG;
var useUKMPG = config.GetUserConfig(User).UseUKMPG;
var hideZero = config.GetUserConfig(User).HideZero;
+ var useThreeDecimals = config.GetUserConfig(User).UseThreeDecimalGasCost;
+ var gasCostFormat = useThreeDecimals ? "C3" : "C2";
var useKwh = Model.UseKwh;
string consumptionUnit;
string fuelEconomyUnit;
@@ -42,7 +44,7 @@
@($"Max Fuel Economy: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")
}
@($"Total Fuel Consumed: {Model.GasRecords.Sum(x => x.Gallons).ToString("F")}")
- @($"Total Cost: {Model.GasRecords.Sum(x => x.Cost).ToString("C3")}")
+ @($"Total Cost: {Model.GasRecords.Sum(x => x.Cost).ToString(gasCostFormat)}")
@if (enableCsvImports)
{
@@ -87,8 +89,8 @@
@gasRecord.Mileage |
@gasRecord.Gallons.ToString("F") |
@(gasRecord.MilesPerGallon == 0 ? "---" : gasRecord.MilesPerGallon.ToString("F")) |
- @((hideZero && gasRecord.Cost == default) ? "---" : gasRecord.Cost.ToString("C3")) |
- @((hideZero && gasRecord.CostPerGallon == default) ? "---" : gasRecord.CostPerGallon.ToString("C3")) |
+ @((hideZero && gasRecord.Cost == default) ? "---" : gasRecord.Cost.ToString(gasCostFormat)) |
+ @((hideZero && gasRecord.CostPerGallon == default) ? "---" : gasRecord.CostPerGallon.ToString(gasCostFormat)) |
}