@qti-components/delivery 0.1.0-next.10 → 0.1.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type { XmlElement, XmlNode } from './model/xml-node.js';
|
|
|
4
4
|
export * from './lifecycle/item-lifecycle.js';
|
|
5
5
|
export * from './lifecycle/item-rules.js';
|
|
6
6
|
export * from './lifecycle/item-session.js';
|
|
7
|
+
export * from './lifecycle/part-submission.js';
|
|
7
8
|
export * from './random/seeded-random.js';
|
|
8
9
|
export * from './random/selection.js';
|
|
9
10
|
export * from './random/shuffle.js';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './model/item-facts.js';
|
|
|
3
3
|
export * from './lifecycle/item-lifecycle.js';
|
|
4
4
|
export * from './lifecycle/item-rules.js';
|
|
5
5
|
export * from './lifecycle/item-session.js';
|
|
6
|
+
export * from './lifecycle/part-submission.js';
|
|
6
7
|
export * from './random/seeded-random.js';
|
|
7
8
|
export * from './random/selection.js';
|
|
8
9
|
export * from './random/shuffle.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './model/test-model.js';\nexport * from './model/item-facts.js';\nexport type { XmlElement, XmlNode } from './model/xml-node.js';\nexport * from './lifecycle/item-lifecycle.js';\nexport * from './lifecycle/item-rules.js';\nexport * from './lifecycle/item-session.js';\nexport * from './random/seeded-random.js';\nexport * from './random/selection.js';\nexport * from './random/shuffle.js';\nexport * from './state/clock.js';\nexport * from './state/commands.js';\nexport * from './state/create-delivery-state.js';\nexport * from './state/delivery-state.js';\nexport * from './processing.js';\nexport * from './timing/timing.js';\nexport * from './timing/time-limits.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './model/test-model.js';\nexport * from './model/item-facts.js';\nexport type { XmlElement, XmlNode } from './model/xml-node.js';\nexport * from './lifecycle/item-lifecycle.js';\nexport * from './lifecycle/item-rules.js';\nexport * from './lifecycle/item-session.js';\nexport * from './lifecycle/part-submission.js';\nexport * from './random/seeded-random.js';\nexport * from './random/selection.js';\nexport * from './random/shuffle.js';\nexport * from './state/clock.js';\nexport * from './state/commands.js';\nexport * from './state/create-delivery-state.js';\nexport * from './state/delivery-state.js';\nexport * from './processing.js';\nexport * from './timing/timing.js';\nexport * from './timing/time-limits.js';\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Effect } from '../state/commands.js';
|
|
2
|
+
import type { ItemInstanceId } from '../state/delivery-state.js';
|
|
3
|
+
import type { ItemSession, ItemSessionFacts } from './item-session.js';
|
|
4
|
+
/** One item session of the part being submitted: its instance, its session so far, and its facts now. */
|
|
5
|
+
export interface PartSubmissionItem {
|
|
6
|
+
readonly item: ItemInstanceId;
|
|
7
|
+
/** The session as the delivery kept it; null when it has none yet (a restored state). */
|
|
8
|
+
readonly previous: ItemSession | null;
|
|
9
|
+
readonly facts: ItemSessionFacts;
|
|
10
|
+
}
|
|
11
|
+
/** The part's item sessions after the submission, in the order given, and what the runtime has to run. */
|
|
12
|
+
export interface PartSubmission {
|
|
13
|
+
readonly sessions: {
|
|
14
|
+
readonly item: ItemInstanceId;
|
|
15
|
+
readonly session: ItemSession;
|
|
16
|
+
}[];
|
|
17
|
+
/** `runOutcomeProcessing` once, after the items. */
|
|
18
|
+
readonly effects: Effect[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Submits a part with simultaneous submission as a whole (QTI 3 info model §2.8.2, implementation
|
|
22
|
+
* guide §4.1): "response processing cannot take place until the test part is complete", and then
|
|
23
|
+
* the candidate's responses "are all submitted together". Each item the candidate opened has its one
|
|
24
|
+
* and only attempt counted and its session closes. Its responses were already processed in the
|
|
25
|
+
* background while the part ran, without ending the attempt (the paper-exam model, decided
|
|
26
|
+
* 2026-12-01), so nothing is processed again here. An item never opened (`completionStatus`
|
|
27
|
+
* `not_attempted`) is closed with its NULL responses and counts no attempt, as a skipped item is. A
|
|
28
|
+
* session already over is left as it is. Outcome processing runs once, after the items (§2.9).
|
|
29
|
+
*
|
|
30
|
+
* Returns null for a part with individual submission: its items are submitted one by one.
|
|
31
|
+
*
|
|
32
|
+
* Experimental (0.x): roadmap 1 phase T6; see `plans/submission-mode-scoring.md`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function submitTestPart(items: readonly PartSubmissionItem[]): PartSubmission | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { seedItemLifecycle, transition, itemLifecycleGuards } from './item-lifecycle.js';
|
|
2
|
+
const OVER = new Set(['closed', 'review', 'solution']);
|
|
3
|
+
/**
|
|
4
|
+
* Submits a part with simultaneous submission as a whole (QTI 3 info model §2.8.2, implementation
|
|
5
|
+
* guide §4.1): "response processing cannot take place until the test part is complete", and then
|
|
6
|
+
* the candidate's responses "are all submitted together". Each item the candidate opened has its one
|
|
7
|
+
* and only attempt counted and its session closes. Its responses were already processed in the
|
|
8
|
+
* background while the part ran, without ending the attempt (the paper-exam model, decided
|
|
9
|
+
* 2026-12-01), so nothing is processed again here. An item never opened (`completionStatus`
|
|
10
|
+
* `not_attempted`) is closed with its NULL responses and counts no attempt, as a skipped item is. A
|
|
11
|
+
* session already over is left as it is. Outcome processing runs once, after the items (§2.9).
|
|
12
|
+
*
|
|
13
|
+
* Returns null for a part with individual submission: its items are submitted one by one.
|
|
14
|
+
*
|
|
15
|
+
* Experimental (0.x): roadmap 1 phase T6; see `plans/submission-mode-scoring.md`.
|
|
16
|
+
*/
|
|
17
|
+
export function submitTestPart(items) {
|
|
18
|
+
if (items.some(({ facts }) => facts.submissionMode !== 'simultaneous'))
|
|
19
|
+
return null;
|
|
20
|
+
const sessions = [];
|
|
21
|
+
const effects = [];
|
|
22
|
+
for (const { item, previous, facts } of items) {
|
|
23
|
+
const { adaptive } = facts;
|
|
24
|
+
const state = previous?.state ?? seedItemLifecycle(facts);
|
|
25
|
+
if (OVER.has(state)) {
|
|
26
|
+
sessions.push({ item, session: { state, numAttempts: facts.numAttempts, adaptive } });
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
// A restored session not on screen seeds as `initial`; `completionStatus` still says it was opened.
|
|
30
|
+
const opened = state !== 'initial' || facts.completionStatus !== 'not_attempted';
|
|
31
|
+
const guards = itemLifecycleGuards({ ...facts, left: facts.passed, modalFeedback: false });
|
|
32
|
+
sessions.push({
|
|
33
|
+
item,
|
|
34
|
+
session: {
|
|
35
|
+
state: transition(state, 'endItemSession', guards) ?? 'closed',
|
|
36
|
+
numAttempts: facts.numAttempts + (opened ? 1 : 0),
|
|
37
|
+
adaptive
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
effects.push({ type: 'runOutcomeProcessing' });
|
|
42
|
+
return { sessions, effects };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=part-submission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part-submission.js","sourceRoot":"","sources":["../../src/lifecycle/part-submission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAqBzF,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAAC,KAAoC;IACjE,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC;QAAE,OAAO,IAAI,CAAC;IACpF,MAAM,QAAQ,GAA+B,EAAE,CAAC;IAChD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;QAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QAC3B,MAAM,KAAK,GAAG,QAAQ,EAAE,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;YACtF,SAAS;QACX,CAAC;QACD,oGAAoG;QACpG,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,gBAAgB,KAAK,eAAe,CAAC;QACjF,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3F,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI;YACJ,OAAO,EAAE;gBACP,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,CAAC,IAAI,QAAQ;gBAC9D,WAAW,EAAE,KAAK,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjD,QAAQ;aACT;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC/C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["import { seedItemLifecycle, transition, itemLifecycleGuards } from './item-lifecycle.js';\n\nimport type { Effect } from '../state/commands.js';\nimport type { ItemInstanceId } from '../state/delivery-state.js';\nimport type { ItemSession, ItemSessionFacts } from './item-session.js';\n\n/** One item session of the part being submitted: its instance, its session so far, and its facts now. */\nexport interface PartSubmissionItem {\n readonly item: ItemInstanceId;\n /** The session as the delivery kept it; null when it has none yet (a restored state). */\n readonly previous: ItemSession | null;\n readonly facts: ItemSessionFacts;\n}\n\n/** The part's item sessions after the submission, in the order given, and what the runtime has to run. */\nexport interface PartSubmission {\n readonly sessions: { readonly item: ItemInstanceId; readonly session: ItemSession }[];\n /** `runOutcomeProcessing` once, after the items. */\n readonly effects: Effect[];\n}\n\nconst OVER = new Set(['closed', 'review', 'solution']);\n\n/**\n * Submits a part with simultaneous submission as a whole (QTI 3 info model §2.8.2, implementation\n * guide §4.1): \"response processing cannot take place until the test part is complete\", and then\n * the candidate's responses \"are all submitted together\". Each item the candidate opened has its one\n * and only attempt counted and its session closes. Its responses were already processed in the\n * background while the part ran, without ending the attempt (the paper-exam model, decided\n * 2026-12-01), so nothing is processed again here. An item never opened (`completionStatus`\n * `not_attempted`) is closed with its NULL responses and counts no attempt, as a skipped item is. A\n * session already over is left as it is. Outcome processing runs once, after the items (§2.9).\n *\n * Returns null for a part with individual submission: its items are submitted one by one.\n *\n * Experimental (0.x): roadmap 1 phase T6; see `plans/submission-mode-scoring.md`.\n */\nexport function submitTestPart(items: readonly PartSubmissionItem[]): PartSubmission | null {\n if (items.some(({ facts }) => facts.submissionMode !== 'simultaneous')) return null;\n const sessions: PartSubmission['sessions'] = [];\n const effects: Effect[] = [];\n for (const { item, previous, facts } of items) {\n const { adaptive } = facts;\n const state = previous?.state ?? seedItemLifecycle(facts);\n if (OVER.has(state)) {\n sessions.push({ item, session: { state, numAttempts: facts.numAttempts, adaptive } });\n continue;\n }\n // A restored session not on screen seeds as `initial`; `completionStatus` still says it was opened.\n const opened = state !== 'initial' || facts.completionStatus !== 'not_attempted';\n const guards = itemLifecycleGuards({ ...facts, left: facts.passed, modalFeedback: false });\n sessions.push({\n item,\n session: {\n state: transition(state, 'endItemSession', guards) ?? 'closed',\n numAttempts: facts.numAttempts + (opened ? 1 : 0),\n adaptive\n }\n });\n }\n effects.push({ type: 'runOutcomeProcessing' });\n return { sessions, effects };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qti-components/delivery",
|
|
3
3
|
"description": "The QTI 3 delivery engine: test model, item session lifecycle, sequencing and session state, with no browser globals",
|
|
4
|
-
"version": "0.1.0-next.
|
|
4
|
+
"version": "0.1.0-next.11",
|
|
5
5
|
"author": "",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"qti",
|