From e7297218be7137a85fa41ff3bb04c440eee9c99f Mon Sep 17 00:00:00 2001
From: jojohoch <joachim.hoch@iqb.hu-berlin.de>
Date: Fri, 15 Dec 2023 10:09:15 +0100
Subject: [PATCH] Rename getAnswerScheme() with getVariableInfos()

---
 .../cloze/cloze-child-elements/text-field-simple.ts         | 2 +-
 .../cloze/cloze-child-elements/toggle-button.ts             | 6 +++---
 .../models/elements/compound-elements/likert/likert-row.ts  | 6 +++---
 .../models/elements/compound-elements/likert/likert.ts      | 4 ++--
 projects/common/models/elements/element.ts                  | 4 ++--
 projects/common/models/elements/geometry/geometry.ts        | 2 +-
 projects/common/models/elements/input-elements/checkbox.ts  | 6 +++---
 projects/common/models/elements/input-elements/drop-list.ts | 6 +++---
 projects/common/models/elements/input-elements/dropdown.ts  | 6 +++---
 .../common/models/elements/input-elements/hotspot-image.ts  | 2 +-
 .../common/models/elements/input-elements/math-field.ts     | 2 +-
 .../common/models/elements/input-elements/math-table.ts     | 2 +-
 .../elements/input-elements/radio-button-group-complex.ts   | 6 +++---
 .../models/elements/input-elements/radio-button-group.ts    | 6 +++---
 projects/common/models/elements/input-elements/slider.ts    | 6 +++---
 .../common/models/elements/input-elements/spell-correct.ts  | 2 +-
 .../common/models/elements/input-elements/text-area-math.ts | 2 +-
 projects/common/models/elements/input-elements/text-area.ts | 2 +-
 .../common/models/elements/input-elements/text-field.ts     | 2 +-
 projects/common/models/elements/media-elements/image.ts     | 6 +++---
 projects/common/models/elements/text/text.ts                | 2 +-
 projects/common/models/page.ts                              | 4 ++--
 projects/common/models/section.ts                           | 6 +++---
 projects/common/models/unit.ts                              | 4 ++--
 projects/editor/src/app/services/verona-api.service.ts      | 2 +-
 25 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/text-field-simple.ts b/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/text-field-simple.ts
index 7c14e62db..2dbab7505 100644
--- a/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/text-field-simple.ts
+++ b/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/text-field-simple.ts
@@ -64,7 +64,7 @@ export class TextFieldSimpleElement extends TextInputElement implements TextFiel
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string',
diff --git a/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/toggle-button.ts b/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/toggle-button.ts
index 84324979c..b281a979c 100644
--- a/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/toggle-button.ts
+++ b/projects/common/models/elements/compound-elements/cloze/cloze-child-elements/toggle-button.ts
@@ -53,21 +53,21 @@ export class ToggleButtonElement extends InputElement implements ToggleButtonPro
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'integer',
       format: '',
       multiple: false,
       nullable: false,
-      values: this.getAnswerSchemeValues(),
+      values: this.getVariableInfoValues(),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
     };
   }
 
-  private getAnswerSchemeValues(): VariableValue[] {
+  private getVariableInfoValues(): VariableValue[] {
     return this.options
       .map((option, index) => ({
         value: (index + 1).toString(),
diff --git a/projects/common/models/elements/compound-elements/likert/likert-row.ts b/projects/common/models/elements/compound-elements/likert/likert-row.ts
index c6b6a1407..6fa066893 100644
--- a/projects/common/models/elements/compound-elements/likert/likert-row.ts
+++ b/projects/common/models/elements/compound-elements/likert/likert-row.ts
@@ -39,14 +39,14 @@ export class LikertRowElement extends InputElement implements LikertRowPropertie
     }
   }
 
-  getChildAnswerScheme(options: TextImageLabel[]): VariableInfo {
+  getVariableInfosOfChild(options: TextImageLabel[]): VariableInfo {
     return {
       id: this.id,
       type: 'integer',
       format: '',
       multiple: false,
       nullable: false,
-      values: this.getAnswerSchemeValues(options),
+      values: this.getVariableInfoValues(options),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
@@ -54,7 +54,7 @@ export class LikertRowElement extends InputElement implements LikertRowPropertie
   }
 
   // eslint-disable-next-line class-methods-use-this
-  private getAnswerSchemeValues(options: TextImageLabel[]): VariableValue[] {
+  private getVariableInfoValues(options: TextImageLabel[]): VariableValue[] {
     return options
       .map((option, index) => ({
         value: (index + 1).toString(),
diff --git a/projects/common/models/elements/compound-elements/likert/likert.ts b/projects/common/models/elements/compound-elements/likert/likert.ts
index bfc6242f9..69059d865 100644
--- a/projects/common/models/elements/compound-elements/likert/likert.ts
+++ b/projects/common/models/elements/compound-elements/likert/likert.ts
@@ -117,8 +117,8 @@ export class LikertElement extends CompoundElement implements PositionedUIElemen
     return new LikertElement(this);
   }
 
-  getAnswerScheme(): VariableInfo[] {
-    return this.rows.map(row => row.getChildAnswerScheme(this.options));
+  getVariableInfos(): VariableInfo[] {
+    return this.rows.map(row => row.getVariableInfosOfChild(this.options));
   }
 }
 
diff --git a/projects/common/models/elements/element.ts b/projects/common/models/elements/element.ts
index 4fd37d38a..3e829bd17 100644
--- a/projects/common/models/elements/element.ts
+++ b/projects/common/models/elements/element.ts
@@ -125,7 +125,7 @@ export abstract class UIElement implements UIElementProperties {
   }
 
   // eslint-disable-next-line class-methods-use-this,@typescript-eslint/no-unused-vars
-  getAnswerScheme(options?: unknown): VariableInfo | VariableInfo[] {
+  getVariableInfos(options?: unknown): VariableInfo | VariableInfo[] {
     return [];
   }
 
@@ -289,7 +289,7 @@ export abstract class PlayerElement extends UIElement implements PlayerElementBl
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string', // TODO: change to float after updating npm package!
diff --git a/projects/common/models/elements/geometry/geometry.ts b/projects/common/models/elements/geometry/geometry.ts
index 29ae641d4..2f44c6a42 100644
--- a/projects/common/models/elements/geometry/geometry.ts
+++ b/projects/common/models/elements/geometry/geometry.ts
@@ -78,7 +78,7 @@ export class GeometryElement extends UIElement implements PositionedUIElement, G
     };
   }
 
-  getAnswerScheme(): VariableInfo[] {
+  getVariableInfos(): VariableInfo[] {
     const answerSchemes = this.trackedVariables.map(variable => this.getVariableAnswerScheme(variable));
     answerSchemes.push({
       id: this.id,
diff --git a/projects/common/models/elements/input-elements/checkbox.ts b/projects/common/models/elements/input-elements/checkbox.ts
index 9b42b06f2..0fc41ef8d 100644
--- a/projects/common/models/elements/input-elements/checkbox.ts
+++ b/projects/common/models/elements/input-elements/checkbox.ts
@@ -38,21 +38,21 @@ export class CheckboxElement extends InputElement implements CheckboxProperties
     return new CheckboxElement(this);
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'boolean',
       format: '',
       multiple: false,
       nullable: false,
-      values: this.getAnswerSchemeValues(),
+      values: this.getVariableInfoValues(),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
     };
   }
 
-  private getAnswerSchemeValues(): VariableValue[] {
+  private getVariableInfoValues(): VariableValue[] {
     return [
       { value: 'true', label: `Angekreuzt: ${this.label}` },
       { value: 'false', label: `Nicht Angekreuzt: ${this.label}` }
diff --git a/projects/common/models/elements/input-elements/drop-list.ts b/projects/common/models/elements/input-elements/drop-list.ts
index d5f82762a..812a397f2 100644
--- a/projects/common/models/elements/input-elements/drop-list.ts
+++ b/projects/common/models/elements/input-elements/drop-list.ts
@@ -88,21 +88,21 @@ export class DropListElement extends InputElement implements DropListProperties
     }
   }
 
-  getAnswerScheme(options: DropListElement[]): VariableInfo {
+  getVariableInfos(options: DropListElement[]): VariableInfo {
     return {
       id: this.id,
       type: 'string',
       format: '',
       multiple: true,
       nullable: false,
-      values: this.getAnswerSchemeValues(options),
+      values: this.getVariableInfoValues(options),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
     };
   }
 
-  private getAnswerSchemeValues(dropLists: DropListElement[]): VariableValue[] {
+  private getVariableInfoValues(dropLists: DropListElement[]): VariableValue[] {
     const valueDropLists = dropLists.filter(dropList => dropList.connectedTo.includes(this.id));
     if (valueDropLists.length || this.isSortingList()) {
       return [this, ...valueDropLists]
diff --git a/projects/common/models/elements/input-elements/dropdown.ts b/projects/common/models/elements/input-elements/dropdown.ts
index 95c9a3f89..f62ce65cf 100644
--- a/projects/common/models/elements/input-elements/dropdown.ts
+++ b/projects/common/models/elements/input-elements/dropdown.ts
@@ -46,21 +46,21 @@ export class DropdownElement extends InputElement implements PositionedUIElement
     return new DropdownElement(this);
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'integer',
       format: '',
       multiple: false,
       nullable: this.allowUnset,
-      values: this.getAnswerSchemeValues(),
+      values: this.getVariableInfoValues(),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
     };
   }
 
-  private getAnswerSchemeValues(): VariableValue[] {
+  private getVariableInfoValues(): VariableValue[] {
     return this.options
       .map((option, index) => ({
         value: (index + 1).toString(),
diff --git a/projects/common/models/elements/input-elements/hotspot-image.ts b/projects/common/models/elements/input-elements/hotspot-image.ts
index 8e0c4fb8b..1ab6d9b7b 100644
--- a/projects/common/models/elements/input-elements/hotspot-image.ts
+++ b/projects/common/models/elements/input-elements/hotspot-image.ts
@@ -58,7 +58,7 @@ export class HotspotImageElement extends InputElement implements PositionedUIEle
     return new HotspotImageElement(this);
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'boolean',
diff --git a/projects/common/models/elements/input-elements/math-field.ts b/projects/common/models/elements/input-elements/math-field.ts
index fcd4e3b18..ecafc0aa9 100644
--- a/projects/common/models/elements/input-elements/math-field.ts
+++ b/projects/common/models/elements/input-elements/math-field.ts
@@ -42,7 +42,7 @@ export class MathFieldElement extends InputElement implements MathFieldPropertie
     return new MathFieldElement(this);
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string',
diff --git a/projects/common/models/elements/input-elements/math-table.ts b/projects/common/models/elements/input-elements/math-table.ts
index 4e77667ed..c42378219 100644
--- a/projects/common/models/elements/input-elements/math-table.ts
+++ b/projects/common/models/elements/input-elements/math-table.ts
@@ -67,7 +67,7 @@ export class MathTableElement extends UIElement implements MathTableProperties {
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string',
diff --git a/projects/common/models/elements/input-elements/radio-button-group-complex.ts b/projects/common/models/elements/input-elements/radio-button-group-complex.ts
index ade3d532e..5abf4b11d 100644
--- a/projects/common/models/elements/input-elements/radio-button-group-complex.ts
+++ b/projects/common/models/elements/input-elements/radio-button-group-complex.ts
@@ -48,21 +48,21 @@ export class RadioButtonGroupComplexElement extends InputElement
     return new RadioButtonGroupComplexElement(this);
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'integer',
       format: '',
       multiple: false,
       nullable: false,
-      values: this.getAnswerSchemeValues(),
+      values: this.getVariableInfoValues(),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
     };
   }
 
-  private getAnswerSchemeValues(): VariableValue[] {
+  private getVariableInfoValues(): VariableValue[] {
     return this.options
       .map((option, index) => ({
         value: (index + 1).toString(),
diff --git a/projects/common/models/elements/input-elements/radio-button-group.ts b/projects/common/models/elements/input-elements/radio-button-group.ts
index b62028948..3251e0890 100644
--- a/projects/common/models/elements/input-elements/radio-button-group.ts
+++ b/projects/common/models/elements/input-elements/radio-button-group.ts
@@ -54,21 +54,21 @@ export class RadioButtonGroupElement extends InputElement
     return new RadioButtonGroupElement(this);
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'integer',
       format: '',
       multiple: false,
       nullable: false,
-      values: this.getAnswerSchemeValues(),
+      values: this.getVariableInfoValues(),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
     };
   }
 
-  private getAnswerSchemeValues(): VariableValue[] {
+  private getVariableInfoValues(): VariableValue[] {
     return this.options
       .map((option, index) => ({
         value: (index + 1).toString(),
diff --git a/projects/common/models/elements/input-elements/slider.ts b/projects/common/models/elements/input-elements/slider.ts
index 468dbb886..5e5e92b8c 100644
--- a/projects/common/models/elements/input-elements/slider.ts
+++ b/projects/common/models/elements/input-elements/slider.ts
@@ -50,21 +50,21 @@ export class SliderElement extends InputElement implements PositionedUIElement,
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'integer',
       format: '',
       multiple: false,
       nullable: !this.value && this.value !== 0,
-      values: this.getAnswerSchemeValues(),
+      values: this.getVariableInfoValues(),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
     };
   }
 
-  private getAnswerSchemeValues(): VariableValue[] {
+  private getVariableInfoValues(): VariableValue[] {
     return Array.from({ length: (this.maxValue + 1 - this.minValue) }, (_, index) => (
       { value: (index + this.minValue).toString(), label: (index + this.minValue).toString() }
     )) as VariableValue[];
diff --git a/projects/common/models/elements/input-elements/spell-correct.ts b/projects/common/models/elements/input-elements/spell-correct.ts
index a9cc91196..fa4deb9a6 100644
--- a/projects/common/models/elements/input-elements/spell-correct.ts
+++ b/projects/common/models/elements/input-elements/spell-correct.ts
@@ -35,7 +35,7 @@ export class SpellCorrectElement extends TextInputElement implements PositionedU
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string',
diff --git a/projects/common/models/elements/input-elements/text-area-math.ts b/projects/common/models/elements/input-elements/text-area-math.ts
index 9fc2e56c7..184f258ec 100644
--- a/projects/common/models/elements/input-elements/text-area-math.ts
+++ b/projects/common/models/elements/input-elements/text-area-math.ts
@@ -47,7 +47,7 @@ export class TextAreaMathElement extends InputElement implements TextAreaMathPro
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string',
diff --git a/projects/common/models/elements/input-elements/text-area.ts b/projects/common/models/elements/input-elements/text-area.ts
index 84d5cbf56..109f09266 100644
--- a/projects/common/models/elements/input-elements/text-area.ts
+++ b/projects/common/models/elements/input-elements/text-area.ts
@@ -63,7 +63,7 @@ export class TextAreaElement extends TextInputElement implements PositionedUIEle
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string',
diff --git a/projects/common/models/elements/input-elements/text-field.ts b/projects/common/models/elements/input-elements/text-field.ts
index bfbbbe604..891c9d689 100644
--- a/projects/common/models/elements/input-elements/text-field.ts
+++ b/projects/common/models/elements/input-elements/text-field.ts
@@ -70,7 +70,7 @@ export class TextFieldElement extends TextInputElement implements PositionedUIEl
     }
   }
 
-  getAnswerScheme(): VariableInfo {
+  getVariableInfos(): VariableInfo {
     return {
       id: this.id,
       type: 'string',
diff --git a/projects/common/models/elements/media-elements/image.ts b/projects/common/models/elements/media-elements/image.ts
index 0b86bc9e7..521bb4d2f 100644
--- a/projects/common/models/elements/media-elements/image.ts
+++ b/projects/common/models/elements/media-elements/image.ts
@@ -56,7 +56,7 @@ export class ImageElement extends UIElement implements PositionedUIElement, Imag
     return ImageComponent;
   }
 
-  getAnswerScheme(): VariableInfo | VariableInfo[] {
+  getVariableInfos(): VariableInfo | VariableInfo[] {
     if (!this.magnifier) return [];
     return {
       id: this.id,
@@ -64,7 +64,7 @@ export class ImageElement extends UIElement implements PositionedUIElement, Imag
       format: '',
       multiple: false,
       nullable: false,
-      values: this.getAnswerSchemeValues(),
+      values: this.getVariableInfoValues(),
       valuePositionLabels: [],
       page: '',
       valuesComplete: true
@@ -72,7 +72,7 @@ export class ImageElement extends UIElement implements PositionedUIElement, Imag
   }
 
   // eslint-disable-next-line class-methods-use-this
-  private getAnswerSchemeValues(): VariableValue[] {
+  private getVariableInfoValues(): VariableValue[] {
     return [
       { value: 'true', label: 'Lupe benutzt' },
       { value: 'false', label: 'Lupe nicht benutzt' }
diff --git a/projects/common/models/elements/text/text.ts b/projects/common/models/elements/text/text.ts
index d6b6dbd6b..b7479b54d 100644
--- a/projects/common/models/elements/text/text.ts
+++ b/projects/common/models/elements/text/text.ts
@@ -69,7 +69,7 @@ export class TextElement extends UIElement implements PositionedUIElement, TextP
         this.highlightableOrange;
   }
 
-  getAnswerScheme(): VariableInfo | VariableInfo[] {
+  getVariableInfos(): VariableInfo | VariableInfo[] {
     if (!this.isHighlightable()) return [];
     return {
       id: this.id,
diff --git a/projects/common/models/page.ts b/projects/common/models/page.ts
index 4b7428388..551799b45 100644
--- a/projects/common/models/page.ts
+++ b/projects/common/models/page.ts
@@ -45,8 +45,8 @@ export class Page {
     return this.sections.map(section => section.getAllElements(elementType)).flat();
   }
 
-  getAnswerScheme(dropLists: DropListElement[]): VariableInfo[] {
-    return this.sections.map(section => section.getAnswerScheme(dropLists)).flat();
+  getVariableInfos(dropLists: DropListElement[]): VariableInfo[] {
+    return this.sections.map(section => section.getVariableInfos(dropLists)).flat();
   }
 }
 
diff --git a/projects/common/models/section.ts b/projects/common/models/section.ts
index 5a6081069..b0b0d3b09 100644
--- a/projects/common/models/section.ts
+++ b/projects/common/models/section.ts
@@ -85,11 +85,11 @@ export class Section {
     return allElements;
   }
 
-  getAnswerScheme(dropLists: DropListElement[]): VariableInfo[] {
+  getVariableInfos(dropLists: DropListElement[]): VariableInfo[] {
     return this.getAllElements()
       .map(element => ((element.type === 'drop-list') ?
-        element.getAnswerScheme(dropLists) :
-        element.getAnswerScheme()))
+        element.getVariableInfos(dropLists) :
+        element.getVariableInfos()))
       .flat();
   }
 }
diff --git a/projects/common/models/unit.ts b/projects/common/models/unit.ts
index 2bb6e29e1..ed96d47f6 100644
--- a/projects/common/models/unit.ts
+++ b/projects/common/models/unit.ts
@@ -33,11 +33,11 @@ export class Unit implements UnitProperties {
     return this.pages.map(page => page.getAllElements(elementType)).flat();
   }
 
-  getAnswerScheme(): VariableInfo[] {
+  getVariableInfos(): VariableInfo[] {
     const dropLists: DropListElement[] = [
       ...this.getAllElements('drop-list') as DropListElement[]
     ];
-    return this.pages.map(page => page.getAnswerScheme(dropLists)).flat();
+    return this.pages.map(page => page.getVariableInfos(dropLists)).flat();
   }
 
   /* check if movement is allowed
diff --git a/projects/editor/src/app/services/verona-api.service.ts b/projects/editor/src/app/services/verona-api.service.ts
index 20cc3cfc3..b651232eb 100644
--- a/projects/editor/src/app/services/verona-api.service.ts
+++ b/projects/editor/src/app/services/verona-api.service.ts
@@ -64,7 +64,7 @@ export class VeronaAPIService {
       timeStamp: String(Date.now()),
       unitDefinition: JSON.stringify(unit),
       unitDefinitionType: `${unit.type}@${unit.version}`,
-      variables: unit.getAnswerScheme()
+      variables: unit.getVariableInfos()
     });
   }
 
-- 
GitLab