diff --git a/src/helpers/ItemFactory.js b/src/helpers/ItemFactory.js index 1895e19..19f6ebf 100644 --- a/src/helpers/ItemFactory.js +++ b/src/helpers/ItemFactory.js @@ -8313,11 +8313,14 @@ export class ItemFactory { return items } - pushItem (identifier, xml) { - const guid = Math.random().toString(16).slice(2); - const submissionMode = "simultaneous" + pushItem (identifier, submissionMode, xml) { + const guid = Math.random().toString(16).slice(2) + + // identifier collisions can cause the wrong state or submissionMode to be used + identifier += `-${guid}` + + this.items.push({identifier, guid, submissionMode, xml}) - this.items.push({identifier, guid, submissionMode, xml}); return {identifier}; } } diff --git a/src/helpers/TestFactory.js b/src/helpers/TestFactory.js index 71138c5..7d21021 100644 --- a/src/helpers/TestFactory.js +++ b/src/helpers/TestFactory.js @@ -1576,24 +1576,27 @@ export class TestFactory { return this.tests.find(test => test.id === id) } - pushTest (title, description, items) { - const id = Math.random().toString(16).slice(2); + pushTest (title, description, submissionMode, items) { + const id = Math.random().toString(16).slice(2) - this.tests.push({ + const test = { id, + category: 'uploads', title, description, items: items.map(item => ({ - "identifier": item.identifier, - "sessionControl": item.sessionControl || { - "showFeedback": true, - "validateResponses": false, - "submissionMode": "simultaneous" + identifier: item.identifier, + sessionControl: item.sessionControl || { + showFeedback: true, + validateResponses: submissionMode === 'individual', + submissionMode } })), count: items.length.toString() - }) + } + + this.tests.push(test) - return id; + return test; } } diff --git a/src/views/Home.vue b/src/views/Home.vue index 1d6d45d..1b382fa 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -92,6 +92,26 @@
+ + + + + + + + + + + + + +
TitleItems
+ {{ test.count }} +