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 7c14e62dbd3e0adfc018f8c2adc9008077a333cd..2dbab7505490c457bef176b966ce4d697f171efe 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 84324979ce1c841d1ce05ba26a61f06e86998e24..b281a979cb955166b82f8182eccb93b81cf5fde0 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 c6b6a1407114ca1ecfb3a81d0b8bdaad4fcb823d..6fa06689305fb815d4b023bff71a43a40f1c55c7 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 bfc6242f9d1b34648de11e313fa33262b5d4d031..69059d8650d736fd26d46ef99816269ab2d69171 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 4fd37d38aa2c6179b00697ad23c091c17a17c90a..3e829bd17f1be51c309663297a60ee944cdc5dcb 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 29ae641d4ad998e18606e345abe2f54eaef5308b..2f44c6a42d012db7d16f44f1ce231b69e9c072c3 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 9b42b06f258aae3c27f15c236622f5d9dc67ed15..0fc41ef8d045e1ac6222edde1520ed66db5fc7fd 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 d5f82762afacc56235ee920dd2ff279fd84b1e70..812a397f2834e140b5be594a6f454c635527a94a 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 95c9a3f89e7bf607f5dab2e6a0ac012537d3abd9..f62ce65cfc55825e23e40e7da8cea828fc32d6db 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 8e0c4fb8bd71ee792b1c55ba7d63dcac2aa0f483..1ab6d9b7ba9c1397ec7b9aa60a0f6296eeb97f03 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 fcd4e3b18a65ab5a9ebb725ae2e8a30a3167ce6f..ecafc0aa964c80574c910bf6d08cc95f86fcb934 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 4e77667edd4fc6ad57f26e8f2c033be23c2b2bdc..c42378219778b8e0847135e021086fe669eb5d8a 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 ade3d532e249dcca26844dd77af8e7a5d39b2691..5abf4b11dce9ccf284fc145bebbb6027f1382bde 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 b62028948515dc4585fc140e222b40580e043751..3251e08905df60ddaa8f99d698436c3a5981382a 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 468dbb886c27429a146980b7c35c2a5e0aae4027..5e5e92b8c84221e1f1d7af1aa00dc23e3f276af5 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 a9cc91196d29e39f8817377c13e649da3de4d0df..fa4deb9a624788554d29da3827683fdc42d95cab 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 9fc2e56c72658f91044cffaf6c70cd0b133eea18..184f258ecd67118e81f9e2b624730e20b30a5a6c 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 84d5cbf567aa6224196714225e9fa6996991dec5..109f09266c78d544aec26fa2ebd65fbc69e5b9dd 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 bfbbbe604f5eb4c1408a11e6a1122e12cbc8536d..891c9d6896125bff8f40652c0c65789b667bed25 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 0b86bc9e78b826f32cc4af826fa65744b95b7725..521bb4d2f217a3f435b52ce2c0c38e45f865ec2a 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 d6b6dbd6b16be0bc4c74e502bac0dc2d9f4cedd5..b7479b54dec25e7fb77ab82978d4f1678af09b1b 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 4b74283883e8a997d278b4ae59acddaa978444cd..551799b452dde332d2bf2f089b5e6b173118cb51 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 5a608106973152f17327bb9b7a275e19258aa437..b0b0d3b09fbc8668a92895268f4e89e861246bd5 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 2bb6e29e18676ada3e262ef8080a2666bf31cdd7..ed96d47f6bc6064bfea54f45604b0bb4ad4020b5 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 20cc3cfc3ffe0347b1ba129b8f68a39be0cdc301..b651232eb7440312a2845d4de0c9f5f3315734cb 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() }); }