Skip to content
Snippets Groups Projects
Commit 1a353b33 authored by jojohoch's avatar jojohoch
Browse files

Add TODO for SanitizationService

parent 1b03e923
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ export class SanitizationService { ...@@ -31,6 +31,7 @@ export class SanitizationService {
private static unitDefinitionVersion: [number, number, number] | undefined; private static unitDefinitionVersion: [number, number, number] | undefined;
// TODO: isUnitDefinitionOutdated must not set the unitDefinitionVersion
static isUnitDefinitionOutdated(unitDefinition: Unit): boolean { static isUnitDefinitionOutdated(unitDefinition: Unit): boolean {
SanitizationService.unitDefinitionVersion = SanitizationService.unitDefinitionVersion =
SanitizationService.readUnitDefinitionVersion(unitDefinition as unknown as Record<string, string>); SanitizationService.readUnitDefinitionVersion(unitDefinition as unknown as Record<string, string>);
...@@ -234,6 +235,7 @@ export class SanitizationService { ...@@ -234,6 +235,7 @@ export class SanitizationService {
let childElements: UIElement[]; let childElements: UIElement[];
let doc: ClozeDocument; let doc: ClozeDocument;
// TODO: Put this after repair child element types and create a sub method
if (element.document) { if (element.document) {
childElements = ClozeUtils.getClozeChildElements((element as ClozeElement)); childElements = ClozeUtils.getClozeChildElements((element as ClozeElement));
doc = element.document as ClozeDocument; doc = element.document as ClozeDocument;
...@@ -246,12 +248,14 @@ export class SanitizationService { ...@@ -246,12 +248,14 @@ export class SanitizationService {
doc = SanitizationService.createClozeDocument(element); doc = SanitizationService.createClozeDocument(element);
} }
// TODO: Put this before the previous section and create a sub method
// repair child element types // repair child element types
childElements.forEach(childElement => { childElements.forEach(childElement => {
childElement.type = childElement.type === 'text-field' ? 'text-field-simple' : childElement.type; childElement.type = childElement.type === 'text-field' ? 'text-field-simple' : childElement.type;
childElement.type = childElement.type === 'drop-list' ? 'drop-list-simple' : childElement.type; childElement.type = childElement.type === 'drop-list' ? 'drop-list-simple' : childElement.type;
}); });
// TODO: create a sub method
return { return {
...element, ...element,
document: { document: {
......
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