From 26defbae984dc20f00993384737739db29f0c655 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Thu, 11 Nov 2021 18:37:11 +0100
Subject: [PATCH] Fix likert initialisation to correctly create children
 elements

Before the children were simple javascript objects missing the methods
of out proper typescript objects. Not it correctly calls the constructor
on all row elements instead of just assigning the value.
---
 projects/common/models/compound-elements/likert-element.ts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/projects/common/models/compound-elements/likert-element.ts b/projects/common/models/compound-elements/likert-element.ts
index 7ef09343c..8126c9076 100644
--- a/projects/common/models/compound-elements/likert-element.ts
+++ b/projects/common/models/compound-elements/likert-element.ts
@@ -26,6 +26,13 @@ export class LikertElement extends UIElement implements FontElement, SurfaceUIEl
     Object.assign(this, initFontElement(serializedElement));
     Object.assign(this, initSurfaceElement(serializedElement));
 
+    if (serializedElement?.rows) {
+      this.rows = [];
+      (serializedElement?.rows as LikertElementRow[]).forEach((row: LikertElementRow) => {
+        this.rows.push(new LikertElementRow(row));
+      });
+    }
+
     this.height = serializedElement.height || 200;
     this.width = serializedElement.width || 400;
     this.backgroundColor = serializedElement.backgroundColor as string || 'transparent';
-- 
GitLab