@vue-skuilder/db 0.1.31 → 0.1.32-a
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.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/study/SessionController.ts +8 -0
- package/src/study/services/ResponseProcessor.ts +22 -2
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.32-a",
|
|
8
8
|
"description": "Database layer for vue-skuilder",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"module": "dist/index.mjs",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@nilock2/pouchdb-authentication": "^1.0.2",
|
|
51
|
-
"@vue-skuilder/common": "0.1.
|
|
51
|
+
"@vue-skuilder/common": "0.1.32-a",
|
|
52
52
|
"cross-fetch": "^4.1.0",
|
|
53
53
|
"moment": "^2.29.4",
|
|
54
54
|
"pouchdb": "^9.0.0",
|
|
@@ -44,6 +44,14 @@ export interface ResponseResult {
|
|
|
44
44
|
nextCardAction: Exclude<SessionAction, 'dismiss-error'> | 'none';
|
|
45
45
|
shouldLoadNextCard: boolean;
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* When true, the card requested deferred advancement via `deferAdvance`.
|
|
49
|
+
* The record was logged and ELO updated, but navigation was suppressed.
|
|
50
|
+
* StudySession should stash `nextCardAction` and wait for a
|
|
51
|
+
* `ready-to-advance` event from the card before calling `nextCard()`.
|
|
52
|
+
*/
|
|
53
|
+
deferred?: boolean;
|
|
54
|
+
|
|
47
55
|
// UI Data (let view decide how to render)
|
|
48
56
|
isCorrect: boolean;
|
|
49
57
|
performanceScore?: number; // for shadow color calculation
|
|
@@ -107,9 +107,11 @@ export class ResponseProcessor {
|
|
|
107
107
|
try {
|
|
108
108
|
const history = await cardHistory;
|
|
109
109
|
|
|
110
|
+
let result: ResponseResult;
|
|
111
|
+
|
|
110
112
|
// Handle correct responses
|
|
111
113
|
if (cardRecord.isCorrect) {
|
|
112
|
-
|
|
114
|
+
result = this.processCorrectResponse(
|
|
113
115
|
cardRecord,
|
|
114
116
|
history,
|
|
115
117
|
studySessionItem,
|
|
@@ -120,7 +122,7 @@ export class ResponseProcessor {
|
|
|
120
122
|
);
|
|
121
123
|
} else {
|
|
122
124
|
// Handle incorrect responses
|
|
123
|
-
|
|
125
|
+
result = this.processIncorrectResponse(
|
|
124
126
|
cardRecord,
|
|
125
127
|
history,
|
|
126
128
|
courseRegistrationDoc,
|
|
@@ -132,6 +134,24 @@ export class ResponseProcessor {
|
|
|
132
134
|
sessionViews
|
|
133
135
|
);
|
|
134
136
|
}
|
|
137
|
+
|
|
138
|
+
// Apply deferred advancement: record is logged and ELO updated above,
|
|
139
|
+
// but we suppress navigation so the view retains control of the UI
|
|
140
|
+
// timeline. StudySession will stash the nextCardAction and wait for
|
|
141
|
+
// a `ready-to-advance` event from the view.
|
|
142
|
+
if (cardRecord.deferAdvance && result.shouldLoadNextCard) {
|
|
143
|
+
logger.info(
|
|
144
|
+
'[ResponseProcessor] deferAdvance requested — suppressing navigation, action stashed:',
|
|
145
|
+
{ nextCardAction: result.nextCardAction }
|
|
146
|
+
);
|
|
147
|
+
result = {
|
|
148
|
+
...result,
|
|
149
|
+
shouldLoadNextCard: false,
|
|
150
|
+
deferred: true,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return result;
|
|
135
155
|
} catch (e: unknown) {
|
|
136
156
|
logger.error('[ResponseProcessor] Failed to load card history', { e, cardId });
|
|
137
157
|
throw e;
|