From 77e9f149a75599b7047b11dd8ee2d98655acda64 Mon Sep 17 00:00:00 2001
From: jojohoch <joachim.hoch@iqb.hu-berlin.de>
Date: Fri, 3 Jun 2022 14:55:52 +0200
Subject: [PATCH] [player] Send every value ElementCode value change to the
 backend

---
 projects/player/src/app/services/unit-state.service.ts | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/projects/player/src/app/services/unit-state.service.ts b/projects/player/src/app/services/unit-state.service.ts
index c0a11e17b..dd22bd12d 100644
--- a/projects/player/src/app/services/unit-state.service.ts
+++ b/projects/player/src/app/services/unit-state.service.ts
@@ -105,9 +105,10 @@ export class UnitStateService {
   private setElementCodeStatus(id: string, status: ElementCodeStatus): void {
     const unitStateElementCode = this.getElementCodeById(id);
     if (unitStateElementCode) {
-      if (ElementCodeStatusValue[status] > ElementCodeStatusValue[unitStateElementCode.status]) {
-        unitStateElementCode.status = status;
-        this._elementCodeChanged.next(unitStateElementCode);
+      const actualStatus = unitStateElementCode.status;
+      unitStateElementCode.status = status;
+      this._elementCodeChanged.next(unitStateElementCode);
+      if (ElementCodeStatusValue[status] > ElementCodeStatusValue[actualStatus]) {
         this.checkPresentedPageStatus(this.elementIdPageIndexMap[id]);
       }
     }
-- 
GitLab