diff --git a/src/app/app-root/login/login.component.ts b/src/app/app-root/login/login.component.ts index 6d79fad5902cc9aa283cfc6362d00dbfb0e90d98..df90df85ec456ddf74904d7f87e806eb6cc6f383 100644 --- a/src/app/app-root/login/login.component.ts +++ b/src/app/app-root/login/login.component.ts @@ -35,6 +35,7 @@ export class LoginComponent implements OnInit, OnDestroy { ) { } ngOnInit(): void { + this.mds.setSpinnerOff(); this.routingSubscription = this.route.params.subscribe(params => { this.returnTo = params['returnTo']; }) diff --git a/src/app/test-controller/test-controller.service.ts b/src/app/test-controller/test-controller.service.ts index 8f8d30e3e909bbf69aed1d4ab2723d542434b41b..f840fc1cb494b7d375eb6142e0314d24db911f74 100644 --- a/src/app/test-controller/test-controller.service.ts +++ b/src/app/test-controller/test-controller.service.ts @@ -1,4 +1,4 @@ -import {debounceTime, map, switchMap, takeUntil} from 'rxjs/operators'; +import {debounceTime, map, takeUntil} from 'rxjs/operators'; import {BehaviorSubject, interval, Subject, Subscription, timer} from 'rxjs'; import {Injectable} from '@angular/core'; import {MaxTimerData, Testlet} from './test-controller.classes'; @@ -299,13 +299,17 @@ export class TestControllerService { public terminateTest() { if (this.testConfig.saveResponses) { - this.bs.addBookletLog(this.testId, Date.now(), 'BOOKLETLOCKEDbyTESTEE').pipe( - switchMap(() => { - return this.bs.lockBooklet(this.testId) - }) - ).subscribe(() => { - this.testStatus$.next(TestStatus.TERMINATED); - this.router.navigate(['/']); + this.bs.addBookletLog(this.testId, Date.now(), 'BOOKLETLOCKEDbyTESTEE').subscribe(OK =>{ + // TODO who evaluates TestStatus when navigating to root? + if (OK) { + this.bs.lockBooklet(this.testId).subscribe(bsOk => { + this.testStatus$.next(bsOk ? TestStatus.TERMINATED : TestStatus.ERROR); + this.router.navigate(['/']); + }) + } else { + this.testStatus$.next(TestStatus.ERROR); + this.router.navigate(['/']); + } }) } else { this.testStatus$.next(TestStatus.TERMINATED);