Skip to content

Commit

Permalink
Implemented usage of max. gas density
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkapok committed Aug 14, 2024
1 parent 2c86ac8 commit 0fa4704
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ describe('App settings component', () => {
// * What are the values to test?
// * Scheduler: Change of maxDensity triggers schedule calculation
// * Diver.component.ts: Add tests for rmv and stressRmv save and load
// * PlannerService: MaxGasDensity is used when calling task
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Preferences } from '../shared/preferences';
import { DiveResults } from '../shared/diveresults';
import { ReloadDispatcher } from '../shared/reloadDispatcher';
import { DiveSchedules } from '../shared/dive.schedules';
import { ApplicationSettingsService } from '../shared/ApplicationSettings';

export class ComplexDepthsPage {
constructor(private fixture: ComponentFixture<DepthsComplexComponent>) { }
Expand Down Expand Up @@ -71,6 +72,7 @@ describe('Depths Complex Component', () => {
SubViewStorage, ViewStates, DiveSchedules,
PreferencesStore, Preferences,
DiveResults, ReloadDispatcher,
ApplicationSettingsService,
]
})
.compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ describe('Url Serialization', () => {
units.imperialUnits = imperial;
const schedules = new DiveSchedules(units, dispatcher);
const viewSwitch = new ViewSwitchService(schedules);
const planner = new PlannerService(schedules, dispatcher, viewSwitch, irrelevantFactory, units);
const appSettings = new ApplicationSettingsService(units);
const planner = new PlannerService(schedules, dispatcher, viewSwitch, appSettings, irrelevantFactory, units);
const preferences = new Preferences(viewSwitch, units, schedules, appSettings, new ViewStates());
const normalization = new SettingsNormalizationService(units, schedules);
const urlSerialization = new PlanUrlSerialization(viewSwitch, units, normalization,
Expand Down
3 changes: 2 additions & 1 deletion projects/planner/src/app/shared/planner.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { DiveResults } from './diveresults';
import { ReloadDispatcher } from './reloadDispatcher';
import { DiveSchedules } from './dive.schedules';
import { ViewSwitchService } from './viewSwitchService';
import { ApplicationSettingsService } from './ApplicationSettings';

describe('PlannerService', () => {
let planner: PlannerService;
Expand All @@ -39,7 +40,7 @@ describe('PlannerService', () => {
PlannerService, UnitConversion,
DiveSchedules, ReloadDispatcher,
SettingsNormalizationService, ViewStates,
ViewSwitchService
ViewSwitchService, ApplicationSettingsService
],
imports: []
}).compileComponents();
Expand Down
9 changes: 5 additions & 4 deletions projects/planner/src/app/shared/planner.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { DiveResults } from './diveresults';
import { WayPointsService } from './waypoints.service';
import { WorkersFactoryCommon } from './serial.workers.factory';
import {
GasDensity, CalculatedProfile,
Precision, Segments, LoadedTissue
CalculatedProfile, Precision,
Segments, LoadedTissue
} from 'scuba-physics';
import {
ConsumptionResultDto, ConsumptionRequestDto, EventOptionsDto,
Expand All @@ -20,6 +20,7 @@ import { ReloadDispatcher } from './reloadDispatcher';
import { Logger } from './Logger';
import { ViewSwitchService } from './viewSwitchService';
import { WayPoint } from './wayPoint';
import { ApplicationSettingsService } from './ApplicationSettings';


@Injectable()
Expand All @@ -33,6 +34,7 @@ export class PlannerService extends Streamed {
private schedules: DiveSchedules,
private dispatcher: ReloadDispatcher,
private viewSwitch: ViewSwitchService,
private appSettings: ApplicationSettingsService,
workerFactory: WorkersFactoryCommon,
units: UnitConversion) {
super();
Expand Down Expand Up @@ -201,8 +203,7 @@ export class PlannerService extends Streamed {

private createEventOptions(): EventOptionsDto {
return {
// TODO make maxDensity configurable
maxDensity: GasDensity.recommendedMaximum
maxDensity: this.appSettings.settings.maxGasDensity
};
}

Expand Down

0 comments on commit 0fa4704

Please sign in to comment.