From ef13c7826a74e45d4e85d808298864a2d927b972 Mon Sep 17 00:00:00 2001 From: Jiri Pokorny Date: Fri, 16 Aug 2024 18:21:21 +0200 Subject: [PATCH] Fixed usage of default density --- .../planner/src/app/app-settings/app-settings.component.ts | 4 ++-- projects/planner/src/app/shared/ApplicationSettings.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/planner/src/app/app-settings/app-settings.component.ts b/projects/planner/src/app/app-settings/app-settings.component.ts index c6f1c7d7..95ee6675 100644 --- a/projects/planner/src/app/app-settings/app-settings.component.ts +++ b/projects/planner/src/app/app-settings/app-settings.component.ts @@ -102,8 +102,8 @@ export class AppSettingsComponent implements OnInit { public resetToDefault(): void { this.settingsForm.patchValue({ imperialUnits: false, - // needs to be always in metric, because we reset to metric - maxDensity: Precision.round(this.appSettings.defaultMaxGasDensity, 1), + // needs to be in current units, because range is not applied yet + maxDensity: Precision.round(this.appSettings.defaultMaxGasDensity, this.ranges.densityRounding), icdIgnored: false, densityIgnored: false, noDecoIgnored: false diff --git a/projects/planner/src/app/shared/ApplicationSettings.ts b/projects/planner/src/app/shared/ApplicationSettings.ts index 9467dbd0..5c20f067 100644 --- a/projects/planner/src/app/shared/ApplicationSettings.ts +++ b/projects/planner/src/app/shared/ApplicationSettings.ts @@ -15,13 +15,14 @@ export class ApplicationSettingsService { return this.appSettings; } + /** in current units **/ public get maxGasDensity(): number { return this.units.fromGramPerLiter(this.appSettings.maxGasDensity); } - /** in metric **/ + /** in current units **/ public get defaultMaxGasDensity(): number { - return GasDensity.recommendedMaximum; + return this.units.fromGramPerLiter(GasDensity.recommendedMaximum); } public get icdIgnored(): boolean {