@pie-qti/assessment-player 0.1.1 → 0.1.5
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/README.md +19 -16
- package/dist/core/AssessmentPlayer.d.ts +30 -8
- package/dist/core/AssessmentPlayer.d.ts.map +1 -1
- package/dist/core/AssessmentPlayer.js +134 -40
- package/dist/core/TimeManager.d.ts +9 -0
- package/dist/core/TimeManager.d.ts.map +1 -1
- package/dist/core/TimeManager.js +16 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/integration/ReferenceBackendAdapter.d.ts +28 -2
- package/dist/integration/ReferenceBackendAdapter.d.ts.map +1 -1
- package/dist/integration/ReferenceBackendAdapter.js +385 -15
- package/dist/integration/api-contract.d.ts +88 -17
- package/dist/integration/api-contract.d.ts.map +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +100 -80
- package/src/components/AssessmentShell.svelte +8 -8
- package/src/components/ItemRenderer.svelte +8 -8
- package/src/components/NavigationBar.svelte +3 -1
- package/src/components/RubricDisplay.svelte +2 -2
- package/src/components/index.ts +1 -1
- package/src/core/AssessmentPlayer.ts +164 -51
- package/src/core/TimeManager.ts +20 -3
- package/src/index.ts +1 -1
- package/src/integration/ReferenceBackendAdapter.ts +454 -23
- package/src/integration/api-contract.ts +89 -17
- package/src/integration/index.ts +5 -5
- package/src/types/index.ts +1 -1
- package/.turbo/turbo-build.log +0 -1
- package/BACKEND-INTEGRATION.md +0 -620
- package/CHANGELOG.md +0 -11
- package/EXTENSIBILITY.md +0 -551
- package/svelte.config.js +0 -8
- package/tests/ReferenceBackendAdapter.spec.ts +0 -309
- package/tests/setup.ts +0 -103
- package/tests/smoke.test.ts +0 -7
- package/tsconfig.json +0 -20
- package/tsconfig.svelte.json +0 -10
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pie-qti/assessment-player
|
|
2
2
|
|
|
3
|
-
QTI 2.
|
|
3
|
+
QTI Assessment Player (QTI 2.2/3.0 compatible item delivery) - Multi-item test player with navigation, sections, and rubric blocks.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -10,13 +10,13 @@ QTI 2.x Assessment Player - Multi-item test player with navigation, sections, an
|
|
|
10
10
|
- ✅ **Rubric blocks** - Reading passages, instructions, and rubrics
|
|
11
11
|
- ✅ **Progress tracking** - Visual progress indicators
|
|
12
12
|
- ✅ **Section menu** - Quick navigation between sections
|
|
13
|
-
- ✅ **Outcome Processing** - QTI
|
|
13
|
+
- ✅ **Outcome Processing** - QTI-aligned scoring with total/weighted/percentage/pass-fail templates
|
|
14
14
|
- ✅ **Test Feedback** - Conditional feedback based on outcome variables
|
|
15
15
|
- ✅ **Time Limits** - Assessment-level countdown timers with warnings and auto-submission
|
|
16
16
|
- ✅ **Item Session Control** - Max attempts, review/skip controls, response validation
|
|
17
17
|
- ✅ **State Persistence** - Auto-save with resume capability and optional backend integration
|
|
18
|
-
- ✅ **Selection & Ordering** - Random item selection and shuffling per QTI
|
|
19
|
-
- ✅ **QTI
|
|
18
|
+
- ✅ **Selection & Ordering** - Random item selection and shuffling per QTI spec
|
|
19
|
+
- ✅ **QTI Role/View Actors** - candidate, scorer, tutor, author, proctor, testConstructor
|
|
20
20
|
- ✅ **Backend Integration** - Optional secure backend API (client-side by default)
|
|
21
21
|
- ✅ **Svelte 5 components** - Modern reactive UI
|
|
22
22
|
- ✅ **TypeScript** - Full type safety
|
|
@@ -112,7 +112,7 @@ console.log('Total score:', results.totalScore, '/', results.maxScore);
|
|
|
112
112
|
|
|
113
113
|
## Assessment Format
|
|
114
114
|
|
|
115
|
-
The player uses a QTI
|
|
115
|
+
The player uses a QTI-aligned JSON format:
|
|
116
116
|
|
|
117
117
|
```typescript
|
|
118
118
|
interface QtiAssessmentTest {
|
|
@@ -156,11 +156,14 @@ interface RubricBlock {
|
|
|
156
156
|
**By default**, the player runs 100% client-side with no backend required. This is perfect for demos, development, and non-critical assessments.
|
|
157
157
|
|
|
158
158
|
**For production**, integrate with a secure backend for:
|
|
159
|
+
|
|
159
160
|
- Server-side scoring (prevent score manipulation)
|
|
160
161
|
- Role-based data filtering (hide correct answers from candidates)
|
|
161
162
|
- Persistent session storage
|
|
162
163
|
- Authentication and authorization
|
|
163
164
|
|
|
165
|
+
The player can be embedded inside an LTI 1.3 / LTI Advantage tool, but LTI launch validation, Deep Linking, AGS grade passback, and NRPS roster lookup are host-application responsibilities. Use the `BackendAdapter` boundary to connect player sessions and submissions to the host tool's LTI-aware backend.
|
|
166
|
+
|
|
164
167
|
### Quick Start
|
|
165
168
|
|
|
166
169
|
```typescript
|
|
@@ -208,18 +211,18 @@ class MyBackendAdapter implements BackendAdapter {
|
|
|
208
211
|
|
|
209
212
|
**See [BACKEND-INTEGRATION.md](./BACKEND-INTEGRATION.md) for complete implementation guide.**
|
|
210
213
|
|
|
211
|
-
## QTI
|
|
214
|
+
## QTI Role/View Actors
|
|
212
215
|
|
|
213
|
-
|
|
216
|
+
QTI roles are audience markers for `view`-controlled content. This player applies the runtime policy below:
|
|
214
217
|
|
|
215
218
|
| Role | Behavior |
|
|
216
219
|
|------|----------|
|
|
217
220
|
| `candidate` | Test-taker - inputs editable, no correct answers shown |
|
|
218
|
-
| `scorer` | Grader - inputs readonly, correct answers shown |
|
|
219
|
-
| `author` | Content
|
|
220
|
-
| `tutor` | Instructional
|
|
221
|
-
| `proctor` | Test
|
|
222
|
-
| `testConstructor` | Test
|
|
221
|
+
| `scorer` | Grader/reviewer - inputs readonly, correct answers shown |
|
|
222
|
+
| `author` | Content authoring review - inputs readonly, correct answers shown |
|
|
223
|
+
| `tutor` | Instructional review - inputs readonly, correct answers shown |
|
|
224
|
+
| `proctor` | Test administration view - inputs readonly, no correct answers shown |
|
|
225
|
+
| `testConstructor` | Test construction review - inputs readonly, correct answers shown |
|
|
223
226
|
|
|
224
227
|
```typescript
|
|
225
228
|
// For test-takers
|
|
@@ -231,7 +234,7 @@ The player implements QTI 2.x standard roles to control behavior:
|
|
|
231
234
|
|
|
232
235
|
## Time Limits
|
|
233
236
|
|
|
234
|
-
QTI
|
|
237
|
+
QTI supports time limits at assessment, test part, section, and item levels. The player provides:
|
|
235
238
|
|
|
236
239
|
- **Countdown timer** - Displays remaining time to candidates
|
|
237
240
|
- **Warning threshold** - Alert before time expires (default: 60 seconds)
|
|
@@ -502,7 +505,7 @@ interface PersistableState {
|
|
|
502
505
|
|
|
503
506
|
## Selection & Ordering
|
|
504
507
|
|
|
505
|
-
The assessment player supports QTI
|
|
508
|
+
The assessment player supports QTI selection and ordering rules for creating randomized assessments and item pools.
|
|
506
509
|
|
|
507
510
|
### Selection Rules
|
|
508
511
|
|
|
@@ -699,7 +702,7 @@ ordering: { shuffle: true }
|
|
|
699
702
|
|
|
700
703
|
## Outcome Processing & Scoring
|
|
701
704
|
|
|
702
|
-
The assessment player implements QTI
|
|
705
|
+
The assessment player implements QTI outcome processing patterns for aggregating item scores into assessment-level outcomes.
|
|
703
706
|
|
|
704
707
|
### Scoring Templates
|
|
705
708
|
|
|
@@ -1051,7 +1054,7 @@ Renders individual QTI items within the assessment.
|
|
|
1051
1054
|
|
|
1052
1055
|
**Props:**
|
|
1053
1056
|
- `questionRef: QuestionRef` - Question reference with item XML
|
|
1054
|
-
- `role?: QTIRole` - QTI
|
|
1057
|
+
- `role?: QTIRole` - QTI role/view actor (default: 'candidate')
|
|
1055
1058
|
- `extendedTextEditor?: 'tiptap' | 'textarea'` - Editor type for extended text
|
|
1056
1059
|
- `responses?: Record<string, unknown>` - Response data
|
|
1057
1060
|
- `onResponseChange?: (responseId: string, value: unknown) => void` - Response handler
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
* - Submit responses to BackendAdapter
|
|
8
8
|
* - Apply backend navigation decisions + session state
|
|
9
9
|
*/
|
|
10
|
-
import type { QTIRole } from '@pie-qti/item-player';
|
|
11
|
-
import type { BackendAdapter, InitSessionRequest
|
|
10
|
+
import type { QTIRole, PnpProfile } from '@pie-qti/item-player';
|
|
11
|
+
import type { AssessmentRubricBlock, AssessmentSessionState, BackendAdapter, InitSessionRequest } from '../integration/api-contract.js';
|
|
12
12
|
import type { AssessmentResults, ItemResult, NavigationState } from '../types/index.js';
|
|
13
13
|
export interface BackendAssessmentPlayerConfig {
|
|
14
14
|
backend: BackendAdapter;
|
|
15
15
|
initSession: InitSessionRequest;
|
|
16
16
|
role?: QTIRole;
|
|
17
|
+
/** Optional RNG for deterministic shuffling in selection/ordering. Defaults to Math.random. */
|
|
18
|
+
rng?: () => number;
|
|
17
19
|
/**
|
|
18
20
|
* Optional hint for item renderers that support multiple extended text editors.
|
|
19
21
|
* (Plumbed through the shell; the item player remains authoritative for behavior.)
|
|
@@ -33,11 +35,24 @@ export interface BackendAssessmentPlayerConfig {
|
|
|
33
35
|
allowSectionNavigation?: boolean;
|
|
34
36
|
showProgress?: boolean;
|
|
35
37
|
timeWarningThreshold?: number;
|
|
38
|
+
/**
|
|
39
|
+
* QTI 3.0 §6.2 Personal Needs and Preferences profile.
|
|
40
|
+
* Extended time (pnp.content.extendedTime) is applied to assessment timeLimits.
|
|
41
|
+
* The full profile is passed down to each item player for component-level features
|
|
42
|
+
* (color scheme, elimination tool).
|
|
43
|
+
*/
|
|
44
|
+
pnp?: PnpProfile;
|
|
36
45
|
onItemChange?: (itemIndex: number, totalItems: number) => void;
|
|
37
46
|
onSectionChange?: (sectionIndex: number, totalSections: number) => void;
|
|
38
47
|
onResponseChange?: (responses: Record<string, unknown>) => void;
|
|
39
48
|
onComplete?: () => void;
|
|
40
49
|
}
|
|
50
|
+
type CurrentItemView = {
|
|
51
|
+
identifier: string;
|
|
52
|
+
title?: string;
|
|
53
|
+
required?: boolean;
|
|
54
|
+
itemXml: string;
|
|
55
|
+
};
|
|
41
56
|
export declare class AssessmentPlayer {
|
|
42
57
|
private config;
|
|
43
58
|
static create(config: BackendAssessmentPlayerConfig): Promise<AssessmentPlayer>;
|
|
@@ -49,7 +64,7 @@ export declare class AssessmentPlayer {
|
|
|
49
64
|
private navigationManager;
|
|
50
65
|
private sessionController;
|
|
51
66
|
private timeManager;
|
|
52
|
-
private
|
|
67
|
+
private items;
|
|
53
68
|
private currentItemIndex;
|
|
54
69
|
private currentItemPlayer;
|
|
55
70
|
private responses;
|
|
@@ -63,8 +78,14 @@ export declare class AssessmentPlayer {
|
|
|
63
78
|
private timeExpiredListeners;
|
|
64
79
|
private timeTickListeners;
|
|
65
80
|
private constructor();
|
|
81
|
+
/**
|
|
82
|
+
* Compute effective itemSessionControl for a given item using three-level fallback:
|
|
83
|
+
* section-level (highest priority) → testPart-level → defaults.
|
|
84
|
+
* Section-level values override testPart-level when present.
|
|
85
|
+
*/
|
|
86
|
+
private getEffectiveItemSessionControl;
|
|
66
87
|
private hasAnyResponse;
|
|
67
|
-
private
|
|
88
|
+
private flattenItems;
|
|
68
89
|
getAllSections(): Array<{
|
|
69
90
|
id: string;
|
|
70
91
|
title?: string;
|
|
@@ -72,8 +93,8 @@ export declare class AssessmentPlayer {
|
|
|
72
93
|
index: number;
|
|
73
94
|
}>;
|
|
74
95
|
getNavigationState(): NavigationState;
|
|
75
|
-
|
|
76
|
-
getCurrentRubricBlocks():
|
|
96
|
+
getCurrentItem(): CurrentItemView | null;
|
|
97
|
+
getCurrentRubricBlocks(): AssessmentRubricBlock[];
|
|
77
98
|
getVisibleFeedback(): Array<{
|
|
78
99
|
identifier: string;
|
|
79
100
|
content: string;
|
|
@@ -96,11 +117,11 @@ export declare class AssessmentPlayer {
|
|
|
96
117
|
* Get the current session state snapshot (client-side view).
|
|
97
118
|
* Note: backend remains authoritative; this is intended for simple save/resume.
|
|
98
119
|
*/
|
|
99
|
-
getState():
|
|
120
|
+
getState(): AssessmentSessionState;
|
|
100
121
|
/**
|
|
101
122
|
* Restore a previously saved session state.
|
|
102
123
|
*/
|
|
103
|
-
restoreState(state:
|
|
124
|
+
restoreState(state: AssessmentSessionState): Promise<void>;
|
|
104
125
|
navigateTo(index: number): Promise<void>;
|
|
105
126
|
navigateToSection(sectionId: string): Promise<void>;
|
|
106
127
|
next(): Promise<void>;
|
|
@@ -148,4 +169,5 @@ export declare class AssessmentPlayer {
|
|
|
148
169
|
*/
|
|
149
170
|
private createDefaultI18nProvider;
|
|
150
171
|
}
|
|
172
|
+
export {};
|
|
151
173
|
//# sourceMappingURL=AssessmentPlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssessmentPlayer.d.ts","sourceRoot":"","sources":["../../src/core/AssessmentPlayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"AssessmentPlayer.d.ts","sourceRoot":"","sources":["../../src/core/AssessmentPlayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,KAAK,EACX,qBAAqB,EACrB,sBAAsB,EAEtB,cAAc,EAEd,kBAAkB,EAOlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACX,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,MAAM,mBAAmB,CAAC;AAK3B,MAAM,WAAW,6BAA6B;IAC7C,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,kBAAkB,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+FAA+F;IAC/F,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;IAEf,YAAY,CAAC,EA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I,GAAG,MAAM,IAAI;IAK/C,UAAU,CAAC,QAAQ,EAAE,CAAC,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAK5F,OAAO,IAAI,IAAI;IAetB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,cAAc;IAItB;;;OAGG;IACI,eAAe,IAAI,GAAG;IAI7B;;OAEG;IACH,OAAO,CAAC,yBAAyB;CAUjC"}
|
|
@@ -19,7 +19,7 @@ export class AssessmentPlayer {
|
|
|
19
19
|
constructor(config, init) {
|
|
20
20
|
this.config = config;
|
|
21
21
|
this.timeManager = null;
|
|
22
|
-
this.
|
|
22
|
+
this.items = [];
|
|
23
23
|
this.currentItemIndex = -1;
|
|
24
24
|
this.currentItemPlayer = null;
|
|
25
25
|
this.responses = {};
|
|
@@ -46,14 +46,15 @@ export class AssessmentPlayer {
|
|
|
46
46
|
itemScores: {},
|
|
47
47
|
timing: { startedAt: Date.now(), itemTimes: {}, totalTime: 0 },
|
|
48
48
|
};
|
|
49
|
-
this.
|
|
49
|
+
this.items = this.flattenItems(this.assessment);
|
|
50
50
|
const navigationMode = this.assessment.navigationMode || 'nonlinear';
|
|
51
|
-
this.navigationManager = new NavigationManager(navigationMode, this.
|
|
51
|
+
this.navigationManager = new NavigationManager(navigationMode, this.items.length);
|
|
52
52
|
// Item session control is a UI hint; backend remains authoritative.
|
|
53
|
+
// Start with testPart-level defaults; section-level overrides are applied per item in navigateTo().
|
|
53
54
|
const itemSessionControl = this.assessment.testParts?.[0]?.itemSessionControl;
|
|
54
55
|
this.sessionController = new ItemSessionController(itemSessionControl);
|
|
55
56
|
// Initialize per-item session state so itemSessionControl checks work immediately.
|
|
56
|
-
for (const q of this.
|
|
57
|
+
for (const q of this.items) {
|
|
57
58
|
this.sessionController.initializeItem(q.identifier);
|
|
58
59
|
}
|
|
59
60
|
// Initialize time manager if time limits exist
|
|
@@ -61,6 +62,7 @@ export class AssessmentPlayer {
|
|
|
61
62
|
this.timeManager = new TimeManager({
|
|
62
63
|
assessmentTimeLimits: this.assessment.timeLimits,
|
|
63
64
|
warningThreshold: config.timeWarningThreshold || 60,
|
|
65
|
+
extendedTime: config.pnp?.content?.extendedTime,
|
|
64
66
|
onWarning: (remainingSeconds) => this.notifyTimeWarning(remainingSeconds),
|
|
65
67
|
onExpired: () => this.notifyTimeExpired(),
|
|
66
68
|
onTick: (remainingSeconds, elapsedSeconds) => this.notifyTimeTick(remainingSeconds, elapsedSeconds),
|
|
@@ -68,11 +70,33 @@ export class AssessmentPlayer {
|
|
|
68
70
|
}
|
|
69
71
|
// Restore to backend-provided current item if present
|
|
70
72
|
const startId = this.state.currentItemIdentifier;
|
|
71
|
-
const idx = startId ? this.
|
|
73
|
+
const idx = startId ? this.items.findIndex((q) => q.identifier === startId) : -1;
|
|
72
74
|
if (idx >= 0) {
|
|
73
75
|
this.navigateTo(idx).catch(() => { });
|
|
74
76
|
}
|
|
75
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Compute effective itemSessionControl for a given item using three-level fallback:
|
|
80
|
+
* section-level (highest priority) → testPart-level → defaults.
|
|
81
|
+
* Section-level values override testPart-level when present.
|
|
82
|
+
*/
|
|
83
|
+
getEffectiveItemSessionControl(flat) {
|
|
84
|
+
const testPartControl = flat.testPart.itemSessionControl;
|
|
85
|
+
const sectionControl = flat.section.itemSessionControl;
|
|
86
|
+
if (!sectionControl)
|
|
87
|
+
return testPartControl;
|
|
88
|
+
if (!testPartControl)
|
|
89
|
+
return sectionControl;
|
|
90
|
+
return {
|
|
91
|
+
maxAttempts: sectionControl.maxAttempts ?? testPartControl.maxAttempts,
|
|
92
|
+
showFeedback: sectionControl.showFeedback ?? testPartControl.showFeedback,
|
|
93
|
+
allowReview: sectionControl.allowReview ?? testPartControl.allowReview,
|
|
94
|
+
showSolution: sectionControl.showSolution ?? testPartControl.showSolution,
|
|
95
|
+
allowComment: sectionControl.allowComment ?? testPartControl.allowComment,
|
|
96
|
+
allowSkipping: sectionControl.allowSkipping ?? testPartControl.allowSkipping,
|
|
97
|
+
validateResponses: sectionControl.validateResponses ?? testPartControl.validateResponses,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
76
100
|
hasAnyResponse(responses) {
|
|
77
101
|
for (const v of Object.values(responses)) {
|
|
78
102
|
if (v == null)
|
|
@@ -92,14 +116,25 @@ export class AssessmentPlayer {
|
|
|
92
116
|
}
|
|
93
117
|
return false;
|
|
94
118
|
}
|
|
95
|
-
|
|
119
|
+
flattenItems(assessment) {
|
|
96
120
|
const out = [];
|
|
97
121
|
const testParts = assessment.testParts || [];
|
|
98
122
|
let idx = 0;
|
|
99
123
|
let secIdx = 0;
|
|
124
|
+
const rng = this.config.rng ?? Math.random;
|
|
100
125
|
for (const tp of testParts) {
|
|
101
126
|
for (const section of tp.sections || []) {
|
|
102
|
-
|
|
127
|
+
let refs = [...(section.assessmentItemRefs || [])];
|
|
128
|
+
// QTI ordering: shuffle items within the section when requested.
|
|
129
|
+
// The server may have already shuffled; if not (e.g. reference adapter), do it client-side.
|
|
130
|
+
if (section.ordering?.shuffle) {
|
|
131
|
+
refs = shuffleArray(refs, rng);
|
|
132
|
+
}
|
|
133
|
+
// QTI selection: take only `select` items from the (possibly shuffled) list.
|
|
134
|
+
if (section.selection && section.selection.select > 0 && section.selection.select < refs.length) {
|
|
135
|
+
refs = refs.slice(0, section.selection.select);
|
|
136
|
+
}
|
|
137
|
+
for (const item of refs) {
|
|
103
138
|
out.push({
|
|
104
139
|
identifier: item.identifier,
|
|
105
140
|
item,
|
|
@@ -128,10 +163,10 @@ export class AssessmentPlayer {
|
|
|
128
163
|
return out;
|
|
129
164
|
}
|
|
130
165
|
getNavigationState() {
|
|
131
|
-
const total = this.
|
|
166
|
+
const total = this.items.length;
|
|
132
167
|
const canPrevious = this.canPrevious();
|
|
133
168
|
const canNext = this.canNext();
|
|
134
|
-
const q = this.
|
|
169
|
+
const q = this.items[this.currentItemIndex];
|
|
135
170
|
const totalSections = this.getAllSections().length;
|
|
136
171
|
return {
|
|
137
172
|
currentIndex: this.currentItemIndex,
|
|
@@ -145,11 +180,10 @@ export class AssessmentPlayer {
|
|
|
145
180
|
totalSections,
|
|
146
181
|
};
|
|
147
182
|
}
|
|
148
|
-
|
|
149
|
-
const q = this.
|
|
183
|
+
getCurrentItem() {
|
|
184
|
+
const q = this.items[this.currentItemIndex];
|
|
150
185
|
if (!q)
|
|
151
186
|
return null;
|
|
152
|
-
// Keep the legacy QuestionRef-ish shape expected by ItemRenderer.svelte
|
|
153
187
|
return {
|
|
154
188
|
identifier: q.item.identifier,
|
|
155
189
|
title: q.section.title,
|
|
@@ -158,17 +192,17 @@ export class AssessmentPlayer {
|
|
|
158
192
|
};
|
|
159
193
|
}
|
|
160
194
|
getCurrentRubricBlocks() {
|
|
161
|
-
const q = this.
|
|
195
|
+
const q = this.items[this.currentItemIndex];
|
|
162
196
|
if (!q)
|
|
163
197
|
return [];
|
|
164
|
-
return q.section.
|
|
198
|
+
return q.section.rubricBlocks || q.testPart.rubricBlocks || [];
|
|
165
199
|
}
|
|
166
200
|
getVisibleFeedback() {
|
|
167
201
|
return this.visibleFeedback;
|
|
168
202
|
}
|
|
169
203
|
updateResponse(responseId, value) {
|
|
170
204
|
this.responses = { ...this.responses, [responseId]: value };
|
|
171
|
-
const q = this.
|
|
205
|
+
const q = this.items[this.currentItemIndex];
|
|
172
206
|
if (q) {
|
|
173
207
|
this.state.itemResponses[q.identifier] = this.responses;
|
|
174
208
|
this.sessionController.markAnswered(q.identifier, this.hasAnyResponse(this.responses));
|
|
@@ -186,7 +220,7 @@ export class AssessmentPlayer {
|
|
|
186
220
|
const next = { ...prev, [responseId]: value };
|
|
187
221
|
this.state.itemResponses[itemIdentifier] = next;
|
|
188
222
|
// If this is the active item, keep the live response state + UI hints in sync.
|
|
189
|
-
const active = this.
|
|
223
|
+
const active = this.items[this.currentItemIndex];
|
|
190
224
|
if (active?.identifier === itemIdentifier) {
|
|
191
225
|
this.responses = next;
|
|
192
226
|
this.sessionController.markAnswered(itemIdentifier, this.hasAnyResponse(this.responses));
|
|
@@ -225,7 +259,7 @@ export class AssessmentPlayer {
|
|
|
225
259
|
this.state = state;
|
|
226
260
|
// Restore visited state for UI navigation hints.
|
|
227
261
|
const visitedIdx = (state.visitedItems || [])
|
|
228
|
-
.map((id) => this.
|
|
262
|
+
.map((id) => this.items.findIndex((q) => q.identifier === id))
|
|
229
263
|
.filter((i) => i >= 0);
|
|
230
264
|
this.navigationManager.restoreState(visitedIdx);
|
|
231
265
|
// Rehydrate itemResults from scores if present, so submit() can behave sensibly.
|
|
@@ -241,16 +275,16 @@ export class AssessmentPlayer {
|
|
|
241
275
|
}
|
|
242
276
|
}
|
|
243
277
|
const currentId = state.currentItemIdentifier;
|
|
244
|
-
const idx = currentId ? this.
|
|
278
|
+
const idx = currentId ? this.items.findIndex((q) => q.identifier === currentId) : -1;
|
|
245
279
|
if (idx >= 0) {
|
|
246
280
|
await this.navigateTo(idx);
|
|
247
281
|
}
|
|
248
|
-
else if (this.
|
|
282
|
+
else if (this.items.length > 0) {
|
|
249
283
|
await this.navigateTo(0);
|
|
250
284
|
}
|
|
251
285
|
}
|
|
252
286
|
async navigateTo(index) {
|
|
253
|
-
if (index < 0 || index >= this.
|
|
287
|
+
if (index < 0 || index >= this.items.length)
|
|
254
288
|
throw new Error(`Invalid item index: ${index}`);
|
|
255
289
|
// Enforce navigation rules (UI hints, still backend-authoritative for real deployments).
|
|
256
290
|
if (this.currentItemIndex >= 0 && !this.navigationManager.canNavigateTo(index, this.currentItemIndex)) {
|
|
@@ -259,13 +293,18 @@ export class AssessmentPlayer {
|
|
|
259
293
|
}
|
|
260
294
|
throw new Error('Navigation is not allowed.');
|
|
261
295
|
}
|
|
262
|
-
const target = this.
|
|
296
|
+
const target = this.items[index];
|
|
263
297
|
if (target && !this.sessionController.canReview(target.identifier)) {
|
|
264
298
|
throw new Error('You cannot go back to previous questions in this assessment.');
|
|
265
299
|
}
|
|
266
300
|
this.currentItemIndex = index;
|
|
267
|
-
const q = this.
|
|
301
|
+
const q = this.items[index];
|
|
268
302
|
this.state.currentItemIdentifier = q.identifier;
|
|
303
|
+
// Apply three-level itemSessionControl fallback for this item's section (S1).
|
|
304
|
+
const effectiveControl = this.getEffectiveItemSessionControl(q);
|
|
305
|
+
if (effectiveControl) {
|
|
306
|
+
this.sessionController.updateSettings(effectiveControl);
|
|
307
|
+
}
|
|
269
308
|
// Restore responses
|
|
270
309
|
this.responses = { ...(this.state.itemResponses[q.identifier] || {}) };
|
|
271
310
|
// Create item player
|
|
@@ -279,7 +318,7 @@ export class AssessmentPlayer {
|
|
|
279
318
|
this.notifySectionChange();
|
|
280
319
|
}
|
|
281
320
|
async navigateToSection(sectionId) {
|
|
282
|
-
const idx = this.
|
|
321
|
+
const idx = this.items.findIndex((q) => q.section.identifier === sectionId);
|
|
283
322
|
if (idx >= 0)
|
|
284
323
|
await this.navigateTo(idx);
|
|
285
324
|
}
|
|
@@ -287,7 +326,7 @@ export class AssessmentPlayer {
|
|
|
287
326
|
const state = this.getNavigationState();
|
|
288
327
|
if (!state.canNext)
|
|
289
328
|
return;
|
|
290
|
-
const q = this.
|
|
329
|
+
const q = this.items[this.currentItemIndex];
|
|
291
330
|
if (q) {
|
|
292
331
|
const hasResponses = this.hasAnyResponse(this.responses);
|
|
293
332
|
this.sessionController.markAnswered(q.identifier, hasResponses);
|
|
@@ -314,7 +353,7 @@ export class AssessmentPlayer {
|
|
|
314
353
|
}
|
|
315
354
|
/** Submit current item (server-side scoring) */
|
|
316
355
|
async submitCurrentItem() {
|
|
317
|
-
const q = this.
|
|
356
|
+
const q = this.items[this.currentItemIndex];
|
|
318
357
|
if (!q)
|
|
319
358
|
throw new Error('No current item');
|
|
320
359
|
const submittedAt = Date.now();
|
|
@@ -354,11 +393,39 @@ export class AssessmentPlayer {
|
|
|
354
393
|
}
|
|
355
394
|
this.sessionController.markAnswered(q.identifier, this.hasAnyResponse(this.responses));
|
|
356
395
|
this.navigationManager.markVisited(this.currentItemIndex);
|
|
357
|
-
// Apply backend branching decision if provided
|
|
396
|
+
// Apply backend branching decision if provided.
|
|
397
|
+
// Special QTI targets EXIT_TEST / EXIT_TESTPART / EXIT_SECTION trigger finalization.
|
|
358
398
|
if (res.nextItemIdentifier) {
|
|
359
|
-
const
|
|
360
|
-
if (
|
|
361
|
-
|
|
399
|
+
const special = res.nextItemIdentifier;
|
|
400
|
+
if (special === 'EXIT_TEST') {
|
|
401
|
+
// Finalize immediately — no further navigation
|
|
402
|
+
for (const l of this.completeListeners)
|
|
403
|
+
l();
|
|
404
|
+
this.config.onComplete?.();
|
|
405
|
+
}
|
|
406
|
+
else if (special === 'EXIT_TESTPART' || special === 'EXIT_SECTION') {
|
|
407
|
+
// Advance past all remaining items in the current testPart or section
|
|
408
|
+
const currentItem = this.items[this.currentItemIndex];
|
|
409
|
+
const isSection = special === 'EXIT_SECTION';
|
|
410
|
+
const nextIdx = this.items.findIndex((item, i) => i > this.currentItemIndex &&
|
|
411
|
+
(isSection
|
|
412
|
+
? item.section.identifier !== currentItem?.section.identifier
|
|
413
|
+
: item.testPart.identifier !== currentItem?.testPart.identifier));
|
|
414
|
+
if (nextIdx >= 0) {
|
|
415
|
+
await this.navigateTo(nextIdx);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
// No further items — signal completion
|
|
419
|
+
for (const l of this.completeListeners)
|
|
420
|
+
l();
|
|
421
|
+
this.config.onComplete?.();
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
const nextIdx = this.items.findIndex((x) => x.identifier === special);
|
|
426
|
+
if (nextIdx >= 0) {
|
|
427
|
+
await this.navigateTo(nextIdx);
|
|
428
|
+
}
|
|
362
429
|
}
|
|
363
430
|
}
|
|
364
431
|
return itemResult;
|
|
@@ -366,7 +433,7 @@ export class AssessmentPlayer {
|
|
|
366
433
|
canPrevious() {
|
|
367
434
|
if (this.currentItemIndex <= 0)
|
|
368
435
|
return false;
|
|
369
|
-
const prev = this.
|
|
436
|
+
const prev = this.items[this.currentItemIndex - 1];
|
|
370
437
|
if (!prev)
|
|
371
438
|
return false;
|
|
372
439
|
if (!this.navigationManager.canNavigateTo(this.currentItemIndex - 1, this.currentItemIndex))
|
|
@@ -377,7 +444,7 @@ export class AssessmentPlayer {
|
|
|
377
444
|
if (this.currentItemIndex < 0)
|
|
378
445
|
return false;
|
|
379
446
|
const nextIdx = this.currentItemIndex + 1;
|
|
380
|
-
if (nextIdx >= this.
|
|
447
|
+
if (nextIdx >= this.items.length)
|
|
381
448
|
return false;
|
|
382
449
|
if (!this.navigationManager.canNavigateTo(nextIdx, this.currentItemIndex))
|
|
383
450
|
return false;
|
|
@@ -394,7 +461,7 @@ export class AssessmentPlayer {
|
|
|
394
461
|
// responses for items that have been submitted so far, which would otherwise
|
|
395
462
|
// wipe out responses for later items during this loop.
|
|
396
463
|
const allItemResponses = { ...(this.state.itemResponses || {}) };
|
|
397
|
-
for (const q of this.
|
|
464
|
+
for (const q of this.items) {
|
|
398
465
|
if (this.itemResults.has(q.identifier))
|
|
399
466
|
continue;
|
|
400
467
|
const submittedAt = Date.now();
|
|
@@ -430,7 +497,7 @@ export class AssessmentPlayer {
|
|
|
430
497
|
}
|
|
431
498
|
else {
|
|
432
499
|
// Ensure current item is submitted (individual submission mode)
|
|
433
|
-
const q = this.
|
|
500
|
+
const q = this.items[this.currentItemIndex];
|
|
434
501
|
if (q && !this.itemResults.has(q.identifier)) {
|
|
435
502
|
await this.submitCurrentItem();
|
|
436
503
|
}
|
|
@@ -448,9 +515,27 @@ export class AssessmentPlayer {
|
|
|
448
515
|
maxScore: r.maxScore,
|
|
449
516
|
responses: this.state.itemResponses[r.itemIdentifier] || {},
|
|
450
517
|
}));
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
518
|
+
// Evaluate testFeedback visibility using QTI string equality:
|
|
519
|
+
// show when outcomeIdentifier's value equals feedback.identifier (for showHide='show'),
|
|
520
|
+
// or does NOT equal it (for showHide='hide').
|
|
521
|
+
const structuredFeedback = this.assessment.testFeedback ?? [];
|
|
522
|
+
const outcomes = finalized.outcomes ?? {};
|
|
523
|
+
if (structuredFeedback.length > 0) {
|
|
524
|
+
this.visibleFeedback = structuredFeedback
|
|
525
|
+
.filter((fb) => fb.access === 'atEnd')
|
|
526
|
+
.filter((fb) => {
|
|
527
|
+
const outcomeValue = String(outcomes[fb.outcomeIdentifier] ?? '');
|
|
528
|
+
const matches = outcomeValue === fb.identifier;
|
|
529
|
+
return fb.showHide === 'show' ? matches : !matches;
|
|
530
|
+
})
|
|
531
|
+
.map((fb) => ({ identifier: fb.identifier, content: fb.content, access: fb.access }));
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
// Legacy: backend returns a plain feedback string
|
|
535
|
+
this.visibleFeedback = finalized.feedback
|
|
536
|
+
? [{ identifier: 'testFeedback', content: finalized.feedback, access: 'atEnd' }]
|
|
537
|
+
: [];
|
|
538
|
+
}
|
|
454
539
|
this.notifyComplete();
|
|
455
540
|
if (this.config.onComplete)
|
|
456
541
|
this.config.onComplete();
|
|
@@ -465,7 +550,7 @@ export class AssessmentPlayer {
|
|
|
465
550
|
// Session info + time helpers
|
|
466
551
|
// ---------------------------------------------------------------------------
|
|
467
552
|
getItemSessionInfo(_itemIdentifier) {
|
|
468
|
-
const q = this.
|
|
553
|
+
const q = this.items[this.currentItemIndex];
|
|
469
554
|
if (!q)
|
|
470
555
|
return null;
|
|
471
556
|
const id = q.identifier;
|
|
@@ -540,11 +625,11 @@ export class AssessmentPlayer {
|
|
|
540
625
|
// ---------------------------------------------------------------------------
|
|
541
626
|
notifyItemChange() {
|
|
542
627
|
for (const l of this.itemChangeListeners)
|
|
543
|
-
l(this.currentItemIndex, this.
|
|
544
|
-
this.config.onItemChange?.(this.currentItemIndex, this.
|
|
628
|
+
l(this.currentItemIndex, this.items.length);
|
|
629
|
+
this.config.onItemChange?.(this.currentItemIndex, this.items.length);
|
|
545
630
|
}
|
|
546
631
|
notifySectionChange() {
|
|
547
|
-
const q = this.
|
|
632
|
+
const q = this.items[this.currentItemIndex];
|
|
548
633
|
const sectionIndex = q?.sectionIndex ?? 0;
|
|
549
634
|
const totalSections = this.getAllSections().length;
|
|
550
635
|
for (const l of this.sectionChangeListeners)
|
|
@@ -593,3 +678,12 @@ export class AssessmentPlayer {
|
|
|
593
678
|
};
|
|
594
679
|
}
|
|
595
680
|
}
|
|
681
|
+
/** Fisher-Yates shuffle using a provided RNG (returns a new array). */
|
|
682
|
+
function shuffleArray(arr, rng) {
|
|
683
|
+
const out = [...arr];
|
|
684
|
+
for (let i = out.length - 1; i > 0; i--) {
|
|
685
|
+
const j = Math.floor(rng() * (i + 1));
|
|
686
|
+
[out[i], out[j]] = [out[j], out[i]];
|
|
687
|
+
}
|
|
688
|
+
return out;
|
|
689
|
+
}
|
|
@@ -23,6 +23,15 @@ export interface TimeManagerConfig {
|
|
|
23
23
|
onExpired?: () => void;
|
|
24
24
|
/** Callback for time updates (fires every second) */
|
|
25
25
|
onTick?: (remainingSeconds: number, elapsedSeconds: number) => void;
|
|
26
|
+
/**
|
|
27
|
+
* QTI 3.0 PNP extended time accommodation.
|
|
28
|
+
* When active, multiplies assessmentTimeLimits.maxTime by the given multiplier.
|
|
29
|
+
* multiplier: Infinity removes the time limit entirely.
|
|
30
|
+
*/
|
|
31
|
+
extendedTime?: {
|
|
32
|
+
active: boolean;
|
|
33
|
+
multiplier: number;
|
|
34
|
+
};
|
|
26
35
|
}
|
|
27
36
|
export interface TimeTrackingState {
|
|
28
37
|
/** Total elapsed time (ms) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeManager.d.ts","sourceRoot":"","sources":["../../src/core/TimeManager.ts"],"names":[],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AAS,IAAI,OAAO;IASpB;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAY1C;;OAEG;IACH,OAAO,IAAI,IAAI;CAGf"}
|
package/dist/core/TimeManager.js
CHANGED
|
@@ -25,10 +25,23 @@ export class TimeManager {
|
|
|
25
25
|
startedAt: Date.now(),
|
|
26
26
|
isPaused: false,
|
|
27
27
|
};
|
|
28
|
-
// Initialize timer if time limit exists
|
|
28
|
+
// Initialize timer if time limit exists, applying PNP extended-time multiplier if set.
|
|
29
29
|
if (config.assessmentTimeLimits?.maxTime) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const base = config.assessmentTimeLimits.maxTime;
|
|
31
|
+
const et = config.extendedTime;
|
|
32
|
+
if (et?.active && et.multiplier === Infinity) {
|
|
33
|
+
// multiplier: Infinity → unlimited time (no countdown)
|
|
34
|
+
this.maxTimeSeconds = null;
|
|
35
|
+
}
|
|
36
|
+
else if (et?.active && et.multiplier > 0) {
|
|
37
|
+
this.maxTimeSeconds = base * et.multiplier;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.maxTimeSeconds = base;
|
|
41
|
+
}
|
|
42
|
+
if (this.maxTimeSeconds !== null) {
|
|
43
|
+
this.startTimer();
|
|
44
|
+
}
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
/**
|