@pie-qti/assessment-player 0.1.9 → 0.1.10
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/core/AssessmentPlayer.d.ts +3 -7
- package/dist/core/AssessmentPlayer.d.ts.map +1 -1
- package/dist/core/AssessmentPlayer.js +60 -170
- package/dist/core/AssessmentSessionCoordinator.d.ts +51 -0
- package/dist/core/AssessmentSessionCoordinator.d.ts.map +1 -0
- package/dist/core/AssessmentSessionCoordinator.js +215 -0
- package/package.json +7 -6
- package/src/components/ItemRenderer.svelte +66 -67
- package/src/core/AssessmentPlayer.ts +59 -166
- package/src/core/AssessmentSessionCoordinator.ts +274 -0
|
@@ -30,7 +30,7 @@ import type {
|
|
|
30
30
|
NavigationState,
|
|
31
31
|
TimeLimits,
|
|
32
32
|
} from '../types/index.js';
|
|
33
|
-
import {
|
|
33
|
+
import { AssessmentSessionCoordinator } from './AssessmentSessionCoordinator.js';
|
|
34
34
|
import { NavigationManager } from './NavigationManager.js';
|
|
35
35
|
import { TimeManager } from './TimeManager.js';
|
|
36
36
|
|
|
@@ -122,18 +122,15 @@ export class AssessmentPlayer {
|
|
|
122
122
|
private backend: BackendAdapter;
|
|
123
123
|
private sessionId: SessionId;
|
|
124
124
|
private assessment: SecureAssessment;
|
|
125
|
-
private state: AssessmentSessionState;
|
|
126
125
|
private i18nProvider: any; // I18nProvider from @pie-qti/i18n
|
|
127
126
|
|
|
128
127
|
private navigationManager: NavigationManager;
|
|
129
|
-
private
|
|
128
|
+
private sessionCoordinator!: AssessmentSessionCoordinator;
|
|
130
129
|
private timeManager: TimeManager | null = null;
|
|
131
130
|
|
|
132
131
|
private items: FlatItem[] = [];
|
|
133
132
|
private currentItemIndex = -1;
|
|
134
133
|
private currentItemPlayer: Player | null = null;
|
|
135
|
-
private responses: Record<string, unknown> = {};
|
|
136
|
-
private itemResults: Map<string, ItemResult> = new Map();
|
|
137
134
|
private visibleFeedback: Array<{ identifier: string; content: string; access: string }> = [];
|
|
138
135
|
|
|
139
136
|
// Event listeners
|
|
@@ -150,7 +147,7 @@ export class AssessmentPlayer {
|
|
|
150
147
|
this.sessionId = init.sessionId;
|
|
151
148
|
this.assessment = init.assessment;
|
|
152
149
|
this.i18nProvider = config.i18nProvider ?? this.createDefaultI18nProvider();
|
|
153
|
-
|
|
150
|
+
const initialState =
|
|
154
151
|
init.restoredState ??
|
|
155
152
|
({
|
|
156
153
|
currentItemIdentifier: '',
|
|
@@ -169,13 +166,11 @@ export class AssessmentPlayer {
|
|
|
169
166
|
// Item session control is a UI hint; backend remains authoritative.
|
|
170
167
|
// Start with testPart-level defaults; section-level overrides are applied per item in navigateTo().
|
|
171
168
|
const itemSessionControl = this.assessment.testParts?.[0]?.itemSessionControl;
|
|
172
|
-
this.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
this.restoreItemSessionsFromState(this.state);
|
|
169
|
+
this.sessionCoordinator = new AssessmentSessionCoordinator({
|
|
170
|
+
state: initialState,
|
|
171
|
+
itemIdentifiers: this.items.map((q) => q.identifier),
|
|
172
|
+
itemSessionControl,
|
|
173
|
+
});
|
|
179
174
|
|
|
180
175
|
this.timeManager = new TimeManager({
|
|
181
176
|
assessmentTimeLimits: this.assessment.timeLimits,
|
|
@@ -196,6 +191,14 @@ export class AssessmentPlayer {
|
|
|
196
191
|
}
|
|
197
192
|
}
|
|
198
193
|
|
|
194
|
+
private get state(): AssessmentSessionState {
|
|
195
|
+
return this.sessionCoordinator.state;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private set state(state: AssessmentSessionState) {
|
|
199
|
+
this.sessionCoordinator.restoreState(state);
|
|
200
|
+
}
|
|
201
|
+
|
|
199
202
|
/**
|
|
200
203
|
* Compute effective itemSessionControl for a given item using three-level fallback:
|
|
201
204
|
* section-level (highest priority) → testPart-level → defaults.
|
|
@@ -283,59 +286,6 @@ export class AssessmentPlayer {
|
|
|
283
286
|
};
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
private hasAnyResponse(responses: Record<string, unknown>): boolean {
|
|
287
|
-
for (const v of Object.values(responses)) {
|
|
288
|
-
if (v == null) continue;
|
|
289
|
-
if (Array.isArray(v)) {
|
|
290
|
-
if (v.length > 0) return true;
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
if (typeof v === 'string') {
|
|
294
|
-
if (v.trim().length > 0) return true;
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
// object / number / boolean etc.
|
|
298
|
-
return true;
|
|
299
|
-
}
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private restoreItemSessionsFromState(state: AssessmentSessionState): void {
|
|
304
|
-
const restoredStates = new Map<string, ItemSessionState>();
|
|
305
|
-
for (const item of this.items) {
|
|
306
|
-
const persisted = state.itemSessionStates?.[item.identifier];
|
|
307
|
-
if (persisted) {
|
|
308
|
-
restoredStates.set(item.identifier, {
|
|
309
|
-
itemIdentifier: item.identifier,
|
|
310
|
-
attemptCount: Math.max(0, persisted.attemptCount),
|
|
311
|
-
isAnswered: persisted.isAnswered,
|
|
312
|
-
isSubmitted: persisted.isSubmitted,
|
|
313
|
-
lastSubmissionTime: persisted.lastSubmissionTime,
|
|
314
|
-
});
|
|
315
|
-
continue;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
const responses = state.itemResponses?.[item.identifier] ?? {};
|
|
319
|
-
const isSubmitted = Boolean(state.itemScores?.[item.identifier]);
|
|
320
|
-
restoredStates.set(item.identifier, {
|
|
321
|
-
itemIdentifier: item.identifier,
|
|
322
|
-
attemptCount: isSubmitted ? 1 : 0,
|
|
323
|
-
isAnswered: this.hasAnyResponse(responses),
|
|
324
|
-
isSubmitted,
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
this.sessionController.restoreStates(restoredStates);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
private getItemSessionStateSnapshot(): Record<string, ItemSessionState> {
|
|
331
|
-
return Object.fromEntries(
|
|
332
|
-
[...this.sessionController.getAllStates().entries()].map(([itemIdentifier, state]) => [
|
|
333
|
-
itemIdentifier,
|
|
334
|
-
{ ...state },
|
|
335
|
-
])
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
289
|
private flattenItems(assessment: SecureAssessment): FlatItem[] {
|
|
340
290
|
const out: FlatItem[] = [];
|
|
341
291
|
const testParts = assessment.testParts || [];
|
|
@@ -431,12 +381,7 @@ export class AssessmentPlayer {
|
|
|
431
381
|
}
|
|
432
382
|
|
|
433
383
|
public updateResponse(responseId: string, value: unknown): void {
|
|
434
|
-
this.
|
|
435
|
-
const q = this.items[this.currentItemIndex];
|
|
436
|
-
if (q) {
|
|
437
|
-
this.state.itemResponses[q.identifier] = this.responses as any;
|
|
438
|
-
this.sessionController.markAnswered(q.identifier, this.hasAnyResponse(this.responses));
|
|
439
|
-
}
|
|
384
|
+
this.sessionCoordinator.updateActiveResponse(responseId, value);
|
|
440
385
|
this.notifyResponseChange();
|
|
441
386
|
}
|
|
442
387
|
|
|
@@ -447,16 +392,12 @@ export class AssessmentPlayer {
|
|
|
447
392
|
* the same responseIdentifier like "RESPONSE" across items).
|
|
448
393
|
*/
|
|
449
394
|
public updateResponseForItem(itemIdentifier: string, responseId: string, value: unknown): void {
|
|
450
|
-
const
|
|
451
|
-
const next = { ...prev, [responseId]: value };
|
|
452
|
-
this.state.itemResponses[itemIdentifier] = next as any;
|
|
453
|
-
this.sessionController.markAnswered(itemIdentifier, this.hasAnyResponse(next));
|
|
395
|
+
const next = this.sessionCoordinator.updateResponseForItem(itemIdentifier, responseId, value);
|
|
454
396
|
|
|
455
397
|
// If this is the active item, keep the live response state + UI hints in sync.
|
|
456
398
|
const active = this.items[this.currentItemIndex];
|
|
457
399
|
if (active?.identifier === itemIdentifier) {
|
|
458
|
-
this.
|
|
459
|
-
this.currentItemPlayer?.setResponses(this.responses as any);
|
|
400
|
+
this.currentItemPlayer?.setResponses(next as any);
|
|
460
401
|
this.notifyResponseChange();
|
|
461
402
|
}
|
|
462
403
|
}
|
|
@@ -466,21 +407,16 @@ export class AssessmentPlayer {
|
|
|
466
407
|
* (Useful for host integrations / web components.)
|
|
467
408
|
*/
|
|
468
409
|
public getResponses(): Record<string, unknown> {
|
|
469
|
-
return
|
|
410
|
+
return this.sessionCoordinator.getActiveResponses();
|
|
470
411
|
}
|
|
471
412
|
|
|
472
413
|
public saveCurrentItemSession(): SerializedItemSessionState | null {
|
|
473
414
|
const q = this.items[this.currentItemIndex];
|
|
474
415
|
if (!q || !this.currentItemPlayer) return null;
|
|
475
|
-
this.
|
|
416
|
+
const responses = this.sessionCoordinator.getActiveResponses();
|
|
417
|
+
this.currentItemPlayer.setResponses(responses as any);
|
|
476
418
|
const result = (this.currentItemPlayer as ItemSessionCapablePlayer).suspendAttempt();
|
|
477
|
-
this.
|
|
478
|
-
...(this.state.itemSessions ?? {}),
|
|
479
|
-
[q.identifier]: result.sessionState,
|
|
480
|
-
};
|
|
481
|
-
this.state.itemResponses[q.identifier] = this.responses as any;
|
|
482
|
-
this.state.timing.itemTimes[q.identifier] = result.duration;
|
|
483
|
-
this.sessionController.markAnswered(q.identifier, this.hasAnyResponse(this.responses));
|
|
419
|
+
this.sessionCoordinator.saveItemSession(q.identifier, responses, result.sessionState, result.duration);
|
|
484
420
|
return result.sessionState;
|
|
485
421
|
}
|
|
486
422
|
|
|
@@ -509,19 +445,7 @@ export class AssessmentPlayer {
|
|
|
509
445
|
* Note: backend remains authoritative; this is intended for simple save/resume.
|
|
510
446
|
*/
|
|
511
447
|
public getState(options: { includeItemSessions?: boolean } = {}): AssessmentSessionState {
|
|
512
|
-
|
|
513
|
-
return {
|
|
514
|
-
...this.state,
|
|
515
|
-
visitedItems: [...this.state.visitedItems],
|
|
516
|
-
itemResponses: { ...this.state.itemResponses },
|
|
517
|
-
itemScores: this.state.itemScores ? { ...this.state.itemScores } : undefined,
|
|
518
|
-
itemSessions: options.includeItemSessions && this.state.itemSessions ? { ...this.state.itemSessions } : undefined,
|
|
519
|
-
itemSessionStates: this.getItemSessionStateSnapshot(),
|
|
520
|
-
timing: {
|
|
521
|
-
...this.state.timing,
|
|
522
|
-
itemTimes: { ...this.state.timing.itemTimes },
|
|
523
|
-
},
|
|
524
|
-
};
|
|
448
|
+
return this.sessionCoordinator.snapshot(options);
|
|
525
449
|
}
|
|
526
450
|
|
|
527
451
|
/**
|
|
@@ -535,20 +459,6 @@ export class AssessmentPlayer {
|
|
|
535
459
|
.map((id) => this.items.findIndex((q) => q.identifier === id))
|
|
536
460
|
.filter((i) => i >= 0);
|
|
537
461
|
this.navigationManager.restoreState(visitedIdx);
|
|
538
|
-
this.restoreItemSessionsFromState(state);
|
|
539
|
-
|
|
540
|
-
// Rehydrate itemResults from scores if present, so submit() can behave sensibly.
|
|
541
|
-
this.itemResults.clear();
|
|
542
|
-
if (state.itemScores) {
|
|
543
|
-
for (const [itemIdentifier, scoring] of Object.entries(state.itemScores)) {
|
|
544
|
-
this.itemResults.set(itemIdentifier, {
|
|
545
|
-
itemIdentifier,
|
|
546
|
-
score: scoring.score,
|
|
547
|
-
maxScore: scoring.maxScore,
|
|
548
|
-
responses: state.itemResponses?.[itemIdentifier] || {},
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
462
|
|
|
553
463
|
const currentId = state.currentItemIdentifier;
|
|
554
464
|
const idx = currentId ? this.items.findIndex((q) => q.identifier === currentId) : -1;
|
|
@@ -570,7 +480,7 @@ export class AssessmentPlayer {
|
|
|
570
480
|
throw new Error('Navigation is not allowed.');
|
|
571
481
|
}
|
|
572
482
|
const target = this.items[index];
|
|
573
|
-
if (!options.restoring && target && !this.
|
|
483
|
+
if (!options.restoring && target && !this.sessionCoordinator.canReview(target.identifier)) {
|
|
574
484
|
throw new Error('You cannot go back to previous questions in this assessment.');
|
|
575
485
|
}
|
|
576
486
|
|
|
@@ -597,11 +507,11 @@ export class AssessmentPlayer {
|
|
|
597
507
|
// Apply three-level itemSessionControl fallback for this item's section (S1).
|
|
598
508
|
const effectiveControl = this.getEffectiveItemSessionControl(q);
|
|
599
509
|
if (effectiveControl) {
|
|
600
|
-
this.
|
|
510
|
+
this.sessionCoordinator.updateItemSessionControl(effectiveControl);
|
|
601
511
|
}
|
|
602
512
|
|
|
603
513
|
// Restore responses
|
|
604
|
-
|
|
514
|
+
const responses = this.sessionCoordinator.activateItem(q.identifier);
|
|
605
515
|
|
|
606
516
|
// Create item player
|
|
607
517
|
this.currentItemPlayer?.destroy();
|
|
@@ -617,7 +527,7 @@ export class AssessmentPlayer {
|
|
|
617
527
|
if (restoredItemSession) {
|
|
618
528
|
(this.currentItemPlayer as ItemSessionCapablePlayer).restoreItemSession(restoredItemSession);
|
|
619
529
|
} else {
|
|
620
|
-
this.currentItemPlayer.setResponses(
|
|
530
|
+
this.currentItemPlayer.setResponses(responses as any);
|
|
621
531
|
}
|
|
622
532
|
|
|
623
533
|
this.notifyItemChange();
|
|
@@ -635,10 +545,10 @@ export class AssessmentPlayer {
|
|
|
635
545
|
|
|
636
546
|
const q = this.items[this.currentItemIndex];
|
|
637
547
|
if (q) {
|
|
638
|
-
const
|
|
639
|
-
this.
|
|
548
|
+
const responses = this.sessionCoordinator.getActiveResponses();
|
|
549
|
+
this.sessionCoordinator.markAnswered(q.identifier, responses);
|
|
640
550
|
|
|
641
|
-
const navAway = this.
|
|
551
|
+
const navAway = this.sessionCoordinator.canNavigateAway(q.identifier, responses);
|
|
642
552
|
if (!navAway.allowed) {
|
|
643
553
|
throw new Error(navAway.reason || 'You must answer this question before continuing.');
|
|
644
554
|
}
|
|
@@ -668,24 +578,22 @@ export class AssessmentPlayer {
|
|
|
668
578
|
|
|
669
579
|
const submittedAt = Date.now();
|
|
670
580
|
let itemSession: SerializedItemSessionState | undefined;
|
|
581
|
+
const responses = this.sessionCoordinator.getActiveResponses();
|
|
671
582
|
if (this.currentItemPlayer) {
|
|
672
|
-
this.currentItemPlayer.setResponses(
|
|
583
|
+
this.currentItemPlayer.setResponses(responses as any);
|
|
673
584
|
const attempt = (this.currentItemPlayer as ItemSessionCapablePlayer).endAttempt({
|
|
674
|
-
validateResponses: this.
|
|
585
|
+
validateResponses: this.sessionCoordinator.mustValidateResponses(),
|
|
675
586
|
});
|
|
676
587
|
if (attempt.validation && !attempt.validation.valid) {
|
|
677
588
|
throw new Error(attempt.validation.issues[0]?.message || 'Submit failed: invalid response');
|
|
678
589
|
}
|
|
679
590
|
itemSession = attempt.sessionState;
|
|
680
|
-
this.
|
|
681
|
-
...(this.state.itemSessions ?? {}),
|
|
682
|
-
[q.identifier]: itemSession,
|
|
683
|
-
};
|
|
591
|
+
this.sessionCoordinator.setItemSession(q.identifier, itemSession);
|
|
684
592
|
}
|
|
685
593
|
const res = await this.backend.submitResponses({
|
|
686
594
|
sessionId: this.sessionId,
|
|
687
595
|
itemIdentifier: q.identifier,
|
|
688
|
-
responses:
|
|
596
|
+
responses: responses as any,
|
|
689
597
|
submittedAt,
|
|
690
598
|
timeSpent: itemSession?.duration,
|
|
691
599
|
timing: this.getSubmitTimingEvidence(q, itemSession?.duration ?? 0),
|
|
@@ -697,19 +605,15 @@ export class AssessmentPlayer {
|
|
|
697
605
|
}
|
|
698
606
|
|
|
699
607
|
if (res.updatedState) {
|
|
700
|
-
|
|
701
|
-
this.state = res.updatedState;
|
|
702
|
-
if (localItemSessions) {
|
|
703
|
-
this.state.itemSessions = { ...(this.state.itemSessions ?? {}), ...localItemSessions };
|
|
704
|
-
}
|
|
608
|
+
this.sessionCoordinator.replaceStatePreservingItemSessions(res.updatedState);
|
|
705
609
|
} else {
|
|
706
610
|
// Minimal state update when backend doesn't return full state.
|
|
707
611
|
this.state.itemScores = this.state.itemScores || {};
|
|
708
612
|
this.state.itemScores[q.identifier] = res.result;
|
|
709
|
-
|
|
710
|
-
this.state.itemResponses[q.identifier] =
|
|
613
|
+
this.sessionCoordinator.markVisited(q.identifier);
|
|
614
|
+
this.state.itemResponses[q.identifier] = responses as any;
|
|
711
615
|
if (itemSession) {
|
|
712
|
-
this.
|
|
616
|
+
this.sessionCoordinator.setItemSession(q.identifier, itemSession);
|
|
713
617
|
}
|
|
714
618
|
}
|
|
715
619
|
|
|
@@ -717,17 +621,17 @@ export class AssessmentPlayer {
|
|
|
717
621
|
itemIdentifier: q.identifier,
|
|
718
622
|
score: res.result.score,
|
|
719
623
|
maxScore: res.result.maxScore,
|
|
720
|
-
responses: { ...
|
|
624
|
+
responses: { ...responses },
|
|
721
625
|
};
|
|
722
|
-
this.
|
|
626
|
+
this.sessionCoordinator.setItemResult(itemResult);
|
|
723
627
|
|
|
724
628
|
// Track item session rules (review/attempts) and visited items for navigation hints.
|
|
725
629
|
try {
|
|
726
|
-
this.
|
|
630
|
+
this.sessionCoordinator.recordAttempt(q.identifier);
|
|
727
631
|
} catch {
|
|
728
632
|
// ignore
|
|
729
633
|
}
|
|
730
|
-
this.
|
|
634
|
+
this.sessionCoordinator.markAnswered(q.identifier, responses);
|
|
731
635
|
this.navigationManager.markVisited(this.currentItemIndex);
|
|
732
636
|
|
|
733
637
|
// Apply backend branching decision if provided.
|
|
@@ -771,7 +675,7 @@ export class AssessmentPlayer {
|
|
|
771
675
|
const prev = this.items[this.currentItemIndex - 1];
|
|
772
676
|
if (!prev) return false;
|
|
773
677
|
if (!this.navigationManager.canNavigateTo(this.currentItemIndex - 1, this.currentItemIndex)) return false;
|
|
774
|
-
return this.
|
|
678
|
+
return this.sessionCoordinator.canReview(prev.identifier);
|
|
775
679
|
}
|
|
776
680
|
|
|
777
681
|
private canNext(): boolean {
|
|
@@ -797,7 +701,7 @@ export class AssessmentPlayer {
|
|
|
797
701
|
const allItemSessions = { ...(this.state.itemSessions || {}) };
|
|
798
702
|
|
|
799
703
|
for (const q of this.items) {
|
|
800
|
-
if (this.
|
|
704
|
+
if (this.sessionCoordinator.hasItemResult(q.identifier)) continue;
|
|
801
705
|
const submittedAt = Date.now();
|
|
802
706
|
const responsesForItem = (allItemResponses?.[q.identifier] || {}) as any;
|
|
803
707
|
const itemSession = this.endItemSessionForSubmit(q, responsesForItem, allItemSessions[q.identifier]);
|
|
@@ -815,20 +719,21 @@ export class AssessmentPlayer {
|
|
|
815
719
|
throw new Error(res.error || `Submit failed for item ${q.identifier}`);
|
|
816
720
|
}
|
|
817
721
|
if (res.updatedState) {
|
|
818
|
-
this.
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
722
|
+
this.sessionCoordinator.replaceStatePreservingResponsesAndSessions(
|
|
723
|
+
res.updatedState,
|
|
724
|
+
allItemResponses,
|
|
725
|
+
allItemSessions
|
|
726
|
+
);
|
|
822
727
|
} else {
|
|
823
728
|
this.state.itemScores = this.state.itemScores || {};
|
|
824
729
|
this.state.itemScores[q.identifier] = res.result;
|
|
825
|
-
|
|
730
|
+
this.sessionCoordinator.markVisited(q.identifier);
|
|
826
731
|
this.state.itemResponses[q.identifier] = responsesForItem;
|
|
827
732
|
if (itemSession) {
|
|
828
|
-
this.
|
|
733
|
+
this.sessionCoordinator.setItemSession(q.identifier, itemSession);
|
|
829
734
|
}
|
|
830
735
|
}
|
|
831
|
-
this.
|
|
736
|
+
this.sessionCoordinator.setItemResult({
|
|
832
737
|
itemIdentifier: q.identifier,
|
|
833
738
|
score: res.result.score,
|
|
834
739
|
maxScore: res.result.maxScore,
|
|
@@ -838,7 +743,7 @@ export class AssessmentPlayer {
|
|
|
838
743
|
} else {
|
|
839
744
|
// Ensure current item is submitted (individual submission mode)
|
|
840
745
|
const q = this.items[this.currentItemIndex];
|
|
841
|
-
if (q && !this.
|
|
746
|
+
if (q && !this.sessionCoordinator.hasItemResult(q.identifier)) {
|
|
842
747
|
await this.submitCurrentItem();
|
|
843
748
|
}
|
|
844
749
|
}
|
|
@@ -906,20 +811,7 @@ export class AssessmentPlayer {
|
|
|
906
811
|
if (!q) return null;
|
|
907
812
|
const id = q.identifier;
|
|
908
813
|
|
|
909
|
-
|
|
910
|
-
if (!state) {
|
|
911
|
-
this.sessionController.initializeItem(id);
|
|
912
|
-
}
|
|
913
|
-
const st = this.sessionController.getItemState(id);
|
|
914
|
-
return {
|
|
915
|
-
canSubmit: this.sessionController.canSubmit(id),
|
|
916
|
-
remainingAttempts: this.sessionController.getRemainingAttempts(id),
|
|
917
|
-
attemptCount: st?.attemptCount ?? 0,
|
|
918
|
-
showFeedback: this.sessionController.shouldShowFeedback(id),
|
|
919
|
-
showSolution: this.sessionController.shouldShowSolution(id),
|
|
920
|
-
canReview: this.sessionController.canReview(id),
|
|
921
|
-
canSkip: this.sessionController.canSkip(id),
|
|
922
|
-
};
|
|
814
|
+
return this.sessionCoordinator.getItemSessionInfo(id);
|
|
923
815
|
}
|
|
924
816
|
|
|
925
817
|
public getRemainingTime(): number {
|
|
@@ -1005,8 +897,9 @@ export class AssessmentPlayer {
|
|
|
1005
897
|
}
|
|
1006
898
|
|
|
1007
899
|
private notifyResponseChange(): void {
|
|
1008
|
-
|
|
1009
|
-
this.
|
|
900
|
+
const responses = this.sessionCoordinator.getActiveResponses();
|
|
901
|
+
for (const l of this.responseChangeListeners) l(responses);
|
|
902
|
+
this.config.onResponseChange?.(responses);
|
|
1010
903
|
}
|
|
1011
904
|
|
|
1012
905
|
private notifyComplete(): void {
|