@patch-adams/core 1.5.2 → 1.5.3
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/cli.cjs +23 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +23 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +23 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4142,8 +4142,9 @@ function generateLrsBridgeCode(options) {
|
|
|
4142
4142
|
});
|
|
4143
4143
|
}
|
|
4144
4144
|
|
|
4145
|
-
// Track submitted Knowledge Check
|
|
4145
|
+
// Track submitted Knowledge Check questions to avoid duplicates
|
|
4146
4146
|
var submittedKnowledgeChecks = {};
|
|
4147
|
+
var kcQuestionCounter = 0;
|
|
4147
4148
|
|
|
4148
4149
|
/**
|
|
4149
4150
|
* Set up interceptors specifically for Rise Knowledge Check blocks
|
|
@@ -4175,16 +4176,26 @@ function generateLrsBridgeCode(options) {
|
|
|
4175
4176
|
* Extract and send xAPI statement for a Knowledge Check submission
|
|
4176
4177
|
*/
|
|
4177
4178
|
function extractKnowledgeCheckResult(kcBlock) {
|
|
4178
|
-
// Get block ID for
|
|
4179
|
+
// Get block ID for context
|
|
4179
4180
|
var blockContainer = kcBlock.closest('[data-block-id]');
|
|
4180
4181
|
var blockId = blockContainer ? blockContainer.getAttribute('data-block-id') : null;
|
|
4181
4182
|
|
|
4183
|
+
// Get question text first \u2014 needed for per-question dedup key
|
|
4184
|
+
var questionText = '';
|
|
4185
|
+
var questionTextEl = kcBlock.querySelector('.quiz-card__title .fr-view, .quiz-card__title');
|
|
4186
|
+
if (questionTextEl) {
|
|
4187
|
+
questionText = questionTextEl.textContent.trim();
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4182
4190
|
// Get question ID from the title element
|
|
4183
4191
|
var questionTitleEl = kcBlock.querySelector('.quiz-card__title');
|
|
4184
|
-
var questionId = questionTitleEl ? questionTitleEl.id :
|
|
4192
|
+
var questionId = questionTitleEl ? questionTitleEl.id : null;
|
|
4193
|
+
|
|
4194
|
+
// Build a question-specific dedup key using question text hash
|
|
4195
|
+
// This ensures each question in a multi-question quiz block gets its own key
|
|
4196
|
+
var questionHash = questionText ? questionText.substring(0, 100) : (questionId || blockId || generateUUID());
|
|
4197
|
+
var submissionKey = 'kc-' + questionHash;
|
|
4185
4198
|
|
|
4186
|
-
// Check if we already processed this submission (avoid duplicates)
|
|
4187
|
-
var submissionKey = blockId || questionId;
|
|
4188
4199
|
var feedbackLabel = kcBlock.querySelector('.quiz-card__feedback-label');
|
|
4189
4200
|
if (!feedbackLabel) {
|
|
4190
4201
|
log('Knowledge Check: No feedback visible yet');
|
|
@@ -4200,11 +4211,9 @@ function generateLrsBridgeCode(options) {
|
|
|
4200
4211
|
}
|
|
4201
4212
|
submittedKnowledgeChecks[submissionId] = true;
|
|
4202
4213
|
|
|
4203
|
-
//
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
if (questionTextEl) {
|
|
4207
|
-
questionText = questionTextEl.textContent.trim();
|
|
4214
|
+
// Use question-specific ID for the statement (not the shared block ID)
|
|
4215
|
+
if (!questionId) {
|
|
4216
|
+
questionId = blockId ? 'q-' + blockId + '-' + questionHash.substring(0, 20) : 'q-' + generateUUID();
|
|
4208
4217
|
}
|
|
4209
4218
|
|
|
4210
4219
|
// Determine question type from aria-label
|
|
@@ -4233,11 +4242,14 @@ function generateLrsBridgeCode(options) {
|
|
|
4233
4242
|
correct: isCorrect
|
|
4234
4243
|
});
|
|
4235
4244
|
|
|
4245
|
+
// Increment question counter for this session
|
|
4246
|
+
kcQuestionCounter++;
|
|
4247
|
+
|
|
4236
4248
|
// Send question answered statement using existing LRS method
|
|
4237
4249
|
LRS.questionAnswered({
|
|
4238
4250
|
questionId: questionId,
|
|
4239
4251
|
questionGuid: blockId || generateUUID(),
|
|
4240
|
-
questionNumber:
|
|
4252
|
+
questionNumber: kcQuestionCounter,
|
|
4241
4253
|
questionText: questionText.substring(0, 500),
|
|
4242
4254
|
questionType: questionType,
|
|
4243
4255
|
answer: answerText.substring(0, 500),
|