From e876bc7f5e7c86033c98b7a78a991668de9acedd Mon Sep 17 00:00:00 2001 From: paflov <paf@titelfrei.de> Date: Fri, 9 Apr 2021 12:35:28 +0200 Subject: [PATCH] fixes a bug which made tests in modes without saveReponses to write back some data when test with saveReponses was opened before. Explanation: The testmode comes later with getTestData and is set correctly in the RUNNING stage, while in LOADING stage it war still the testmode of the test before! So if we opened a test in TRIAL mode after running a test in HOT mode, the loading stage will be write back to backend. As a workaround, we reset to DEMO here, so while in loading stage `saveResponses` is always false. As all tests of one login are always in the same mode, maybe it would be better to retrieve the testmode from the login instead by getTestData. --- src/app/test-controller/test-controller.component.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/test-controller/test-controller.component.ts b/src/app/test-controller/test-controller.component.ts index ccfefdf7..43857a6b 100644 --- a/src/app/test-controller/test-controller.component.ts +++ b/src/app/test-controller/test-controller.component.ts @@ -354,6 +354,11 @@ export class TestControllerComponent implements OnInit, OnDestroy { this.routingSubscription = this.route.params.subscribe(params => { if (this.tcs.testStatus$.getValue() !== TestControllerState.ERROR) { this.tcs.testId = params.t; + + // Reset TestMode to be Demo, before the correct one comes with getTestData + // TODO maybe it would be better to retrieve the testmode from the login + this.tcs.testMode = new TestMode(); + localStorage.setItem(TestControllerComponent.localStorageTestKey, params.t); this.unsubscribeTestSubscriptions(); -- GitLab