diff --git a/doc/roadmap.md b/doc/roadmap.md index 404c524b..9373cb16 100644 --- a/doc/roadmap.md +++ b/doc/roadmap.md @@ -16,7 +16,6 @@ Following list of features and improvements ordered by priority is under develop * Custom diver stress sac rate ratio * Add to general settings * Add to dive settings - * Apply to gas algorithm * Visualize on consumption chart * Add minimum gas reserve for first tank and for stage * Add option to ignore some warnings (ICD, density) diff --git a/projects/planner/src/app/shared/PlanUrlSerialization.spec.ts b/projects/planner/src/app/shared/PlanUrlSerialization.spec.ts index dbe98af3..a9669ff2 100644 --- a/projects/planner/src/app/shared/PlanUrlSerialization.spec.ts +++ b/projects/planner/src/app/shared/PlanUrlSerialization.spec.ts @@ -11,6 +11,7 @@ import { DepthsService } from './depths.service'; import { ReloadDispatcher } from './reloadDispatcher'; import { DiveSchedules } from './dive.schedules'; import { SettingsNormalizationService } from './settings-normalization.service'; +import { Diver } from 'scuba-physics'; class TestSut { constructor( @@ -144,6 +145,22 @@ describe('Url Serialization', () => { expect(result.length).toBeLessThan(2048); }); + describe('Diver options', () => { + it('Serialize both Rmv and stressRmv', () => { + expect(simpleViewUrl).toContain('di=20,30'); + }); + + it('Deserialize both Rmv and stressRmv', () => { + const missingStressUrl = 't=1-18-0-200-0.209-0&' + + 'de=0-30-102-1,30-30-618-1&' + + 'di=24&' + + 'o=0,9,6,3,3,18,2,0.85,0.4,3,1.6,30,1.4,10,1,1,0,2,1&' + + 'ao=0,0'; + complexSut.urlSerialization.fromUrl(missingStressUrl); + expect(complexSut.schedules.selected.optionsService.getDiver()).toEqual(new Diver(24, 36)); + }); + }); + describe('Complex vs. Simple view', () => { it('Load complex plan to simple view',() => { const current = createSimpleSut(); diff --git a/projects/planner/src/app/shared/PlanUrlSerialization.ts b/projects/planner/src/app/shared/PlanUrlSerialization.ts index 0da9af55..041bcbe8 100644 --- a/projects/planner/src/app/shared/PlanUrlSerialization.ts +++ b/projects/planner/src/app/shared/PlanUrlSerialization.ts @@ -165,15 +165,18 @@ export class PlanUrlSerialization { const context = new ParseContext(parseParam, ','); const result: DiverDto = { rmv: context.parseNumber(0), - // TODO add test to verify default value is loaded if not present stressRmv: context.parseNumber(1) }; + if(!result.stressRmv) { + result.stressRmv = new Diver(result.rmv).stressRmv; + } + return result; } private static toDiverParam(di: Diver): string { - const result = `${di.rmv}`; + const result = `${di.rmv},${di.stressRmv}`; return result; } diff --git a/projects/planner/src/app/shared/PlanValidation.ts b/projects/planner/src/app/shared/PlanValidation.ts index 70e39117..260c184c 100644 --- a/projects/planner/src/app/shared/PlanValidation.ts +++ b/projects/planner/src/app/shared/PlanValidation.ts @@ -136,7 +136,7 @@ export class PlanValidation { } private diverValid(diver: DiverDto): boolean { - return this.isRmvValid(diver.rmv); + return this.isRmvValid(diver.rmv) && this.isRmvValid(diver.stressRmv); } private complexModeValid(app: AppPreferencesDto): boolean {