Skip to content

Commit

Permalink
Fixed loading of maxDensity
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkapok committed Aug 13, 2024
1 parent 58aa814 commit c9302aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion projects/planner/src/app/shared/ApplicationSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export class ApplicationSettingsService {
}

public loadFrom(maxDensity: number): void {
this.settings.maxGasDensity = maxDensity || GasDensity.recommendedMaximum;
this.settings.maxGasDensity = maxDensity;
}
}
4 changes: 3 additions & 1 deletion projects/planner/src/app/shared/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { DiveSetup } from './models';
import { DiveSchedule, DiveSchedules } from './dive.schedules';
import { DashBoardViewState } from './views.model';
import { ApplicationSettingsService } from './ApplicationSettings';
import { GasDensity } from "scuba-physics";

@Injectable()
export class Preferences {
Expand Down Expand Up @@ -78,7 +79,8 @@ export class Preferences {
// first apply units to prevent loading of invalid values
this.units.imperialUnits = loaded.options.imperialUnits;
this.applyDives(loaded.dives);
this.appSettings.loadFrom(loaded.options.maxDensity);
const loadedDensity = loaded.options.maxDensity || GasDensity.recommendedMaximum;
this.appSettings.loadFrom(loadedDensity);

// now we are able to switch the view
this.viewSwitch.isComplex = loaded.options.isComplex;
Expand Down

0 comments on commit c9302aa

Please sign in to comment.