Skip to content
Snippets Groups Projects
Commit 29a1b359 authored by rhenck's avatar rhenck
Browse files

Refactor unit definition versioning

- Improve variable naming for unit definiton type. (version string)
- Use 'iqb-aspect-definition@1.0.0' as value which better communicates
  the purpose of the data.
- Also update the HTML files with the new definition. (Even though it is
  not checked anywhere.)
parent d22fcef2
No related branches found
No related tags found
No related merge requests found
import { Page } from './page'; import { Page } from './page';
import { moveArrayItem } from '../util/array'; import { moveArrayItem } from '../util/array';
const EXPORTED_MODULE_VERSION = 'iqb-aspect-module@0.1.1'; export const EXPORTED_MODULE_VERSION = 'iqb-aspect-definition@1.0.0';
export class Unit { export class Unit {
veronaModuleVersion: string; unitDefinitionType = EXPORTED_MODULE_VERSION;
pages: Page[] = []; pages: Page[] = [];
constructor(serializedUnit?: Unit) { constructor(serializedUnit?: Unit) {
this.veronaModuleVersion = EXPORTED_MODULE_VERSION;
if (serializedUnit && serializedUnit.pages.length > 0) { if (serializedUnit && serializedUnit.pages.length > 0) {
serializedUnit?.pages.forEach((page: Page) => { serializedUnit?.pages.forEach((page: Page) => {
this.pages.push(new Page(page)); this.pages.push(new Page(page));
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { fromEvent, Observable, Subject } from 'rxjs'; import { fromEvent, Observable, Subject } from 'rxjs';
import { EXPORTED_MODULE_VERSION } from '../../../../common/models/unit';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -46,7 +47,7 @@ export class VeronaAPIService { ...@@ -46,7 +47,7 @@ export class VeronaAPIService {
type: 'voeReadyNotification', type: 'voeReadyNotification',
apiVersion: '1.1.0', apiVersion: '1.1.0',
notSupportedApiFeatures: '', notSupportedApiFeatures: '',
supportedUnitDefinitionTypes: 'iqb-aspect-module@0.1.0' supportedUnitDefinitionTypes: EXPORTED_MODULE_VERSION
}); });
} }
...@@ -56,7 +57,7 @@ export class VeronaAPIService { ...@@ -56,7 +57,7 @@ export class VeronaAPIService {
sessionId: this.sessionID, sessionId: this.sessionID,
timeStamp: String(Date.now()), timeStamp: String(Date.now()),
unitDefinition: unitDefinition, unitDefinition: unitDefinition,
unitDefinitionType: 'iqb-aspect-module@0.1.0' unitDefinitionType: EXPORTED_MODULE_VERSION
}); });
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
data-version="version-placeholder" data-version="version-placeholder"
data-api-version="2.0.0" data-api-version="2.0.0"
data-repository-url="https://github.com/iqb-berlin/verona-modules-apect" data-repository-url="https://github.com/iqb-berlin/verona-modules-apect"
data-supported-unit-definition-types="iqb-aspect-module@0.1.0"/> data-supported-unit-definition-types="iqb-aspect-definition@1.0.0"/>
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "https://w3id.org/iqb/verona-modules", "@context": "https://w3id.org/iqb/verona-modules",
......
...@@ -62,7 +62,7 @@ export class AppComponent implements OnInit { ...@@ -62,7 +62,7 @@ export class AppComponent implements OnInit {
if (message.unitDefinition) { if (message.unitDefinition) {
const unitDefinition: Unit = new Unit(JSON.parse(message.unitDefinition)); const unitDefinition: Unit = new Unit(JSON.parse(message.unitDefinition));
this.unitStateElementMapperService.registerDropListValueIds(unitDefinition); this.unitStateElementMapperService.registerDropListValueIds(unitDefinition);
if (this.metaDataService.verifyUnitDefinitionVersion(unitDefinition.veronaModuleVersion)) { if (this.metaDataService.verifyUnitDefinitionVersion(unitDefinition.unitDefinitionType)) {
this.playerConfig = message.playerConfig || {}; this.playerConfig = message.playerConfig || {};
this.veronaPostService.sessionId = message.sessionId; this.veronaPostService.sessionId = message.sessionId;
this.veronaPostService.stateReportPolicy = message.playerConfig?.stateReportPolicy || 'none'; this.veronaPostService.stateReportPolicy = message.playerConfig?.stateReportPolicy || 'none';
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
data-repository-url="https://github.com/iqb-berlin/verona-modules-apect" data-repository-url="https://github.com/iqb-berlin/verona-modules-apect"
data-api-version="3.0.0" data-api-version="3.0.0"
data-not-supported-api-features="" data-not-supported-api-features=""
data-supported-unit-definition-types="iqb-aspect-module@0.1.1" data-supported-unit-definition-types="iqb-aspect-definition@1.0.0"
data-supported-unit-state-data-types="iqb-standard@1.0" data-supported-unit-state-data-types="iqb-standard@1.0"
data-supported-browsers='{"Firefox": 69, "Chrome": 72, "Edge": 79}' data-supported-browsers='{"Firefox": 69, "Chrome": 72, "Edge": 79}'
/> />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment