named setting better and only call userconfig method once in the gas tab so it doesn't make as much calls to the cache.

This commit is contained in:
DESKTOP-GENO133\IvanPlex
2024-01-15 13:26:57 -07:00
parent 244a164891
commit 2fafe1101c
2 changed files with 7 additions and 6 deletions

View File

@@ -34,7 +34,7 @@
</div>
<div class="form-check form-switch">
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useThreeDecimal" checked="@Model.UseThreeDecimalGasCost">
<label class="form-check-label" for="useThreeDecimal">Use Three Decimals For Gas Cost</label>
<label class="form-check-label" for="useThreeDecimal">Use Three Decimals For Fuel Cost</label>
</div>
@if (User.IsInRole(nameof(UserData.IsRootUser)))
{

View File

@@ -2,11 +2,12 @@
@inject IConfigHelper config
@model GasRecordViewModelContainer
@{
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
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 userConfig = config.GetUserConfig(User);
var enableCsvImports = userConfig.EnableCsvImports;
var useMPG = userConfig.UseMPG;
var useUKMPG = userConfig.UseUKMPG;
var hideZero = userConfig.HideZero;
var useThreeDecimals = userConfig.UseThreeDecimalGasCost;
var gasCostFormat = useThreeDecimals ? "C3" : "C2";
var useKwh = Model.UseKwh;
string consumptionUnit;