diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b68bed05fd84436648c95ef5ffd2e6e2ebfe00e..10571bc0b700c5f389d66bb9605095617d50b611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,10 @@ Various Bugfixes: * (#341) When you visited a test in demo-mode as a monitor, and terminated it, you returned to the starter but didn't see the monitor-monitor button again. That got fixed. * (#340) After reload you return to the correct unit now * (#335) Order of checks when leaving a unit is fixed: First check completeness, then ask for leaving the timed block -* +* (#347) Dont't check navigationLeaveRestrictions if unit is already time-locked. Minor Changes -* In "demo" mode "showTimeLeft2 is off now +* In "demo" mode "showTimeLeft" is off now ## 12.0.2 Use Font Roboto everywhere diff --git a/src/app/test-controller/routing/unit-route-guards.ts b/src/app/test-controller/routing/unit-route-guards.ts index 92deb56d7e2ff04ab5d0c9a116c8fb36ea5b9177..00634e93bd173f0954d89c6c07a218d447627fae 100644 --- a/src/app/test-controller/routing/unit-route-guards.ts +++ b/src/app/test-controller/routing/unit-route-guards.ts @@ -55,7 +55,7 @@ export class UnitDeactivateGuard implements CanDeactivate<UnithostComponent> { private router: Router ) {} - private checkAndSolve_maxTime(newUnit: UnitControllerData, force: boolean): Observable<boolean> { + private checkAndSolveMaxTime(newUnit: UnitControllerData): Observable<boolean> { if (!this.tcs.currentMaxTimerTestletId) { // leaving unit is not in a timed block return of(true); } @@ -67,10 +67,6 @@ export class UnitDeactivateGuard implements CanDeactivate<UnithostComponent> { ) { return of(true); } - if (force) { - this.tcs.interruptMaxTimer(); - return of(true); - } const dialogCDRef = this.confirmDialog.open(ConfirmDialogComponent, { width: '500px', data: <ConfirmDialogData>{ @@ -95,10 +91,7 @@ export class UnitDeactivateGuard implements CanDeactivate<UnithostComponent> { ); } - private checkAndSolve_Completeness(newUnit: UnitControllerData, force: boolean): Observable<boolean> { - if (force) { - return of(true); - } + private checkAndSolveCompleteness(newUnit: UnitControllerData): Observable<boolean> { const direction = (newUnit && this.tcs.currentUnitSequenceId < newUnit.unitDef.sequenceId) ? 'Next' : 'Prev'; const reasons = this.checkCompleteness(direction); if (!reasons.length) { @@ -109,6 +102,9 @@ export class UnitDeactivateGuard implements CanDeactivate<UnithostComponent> { private checkCompleteness(direction: 'Next' | 'Prev'): VeronaNavigationDeniedReason[] { const unit = this.tcs.rootTestlet.getUnitAt(this.tcs.currentUnitSequenceId); + if (unit.unitDef.locked) { + return []; + } const reasons: VeronaNavigationDeniedReason[] = []; const checkOnValue = { Next: <NavigationLeaveRestrictionValue[]>['ON', 'ALWAYS'], @@ -183,15 +179,14 @@ export class UnitDeactivateGuard implements CanDeactivate<UnithostComponent> { } const forceNavigation = this.router.getCurrentNavigation().extras?.state?.force ?? false; + if (forceNavigation) { + this.tcs.interruptMaxTimer(); + return of(true); + } - return this.checkAndSolve_Completeness(newUnit, forceNavigation) + return this.checkAndSolveCompleteness(newUnit) .pipe( - switchMap(cAsC => { - if (!cAsC) { - return of(false); - } - return this.checkAndSolve_maxTime(newUnit, forceNavigation); - }) + switchMap(cAsC => (!cAsC ? of(false) : this.checkAndSolveMaxTime(newUnit))) ); } }