@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.cjs
CHANGED
|
@@ -4152,8 +4152,9 @@ function generateLrsBridgeCode(options) {
|
|
|
4152
4152
|
});
|
|
4153
4153
|
}
|
|
4154
4154
|
|
|
4155
|
-
// Track submitted Knowledge Check
|
|
4155
|
+
// Track submitted Knowledge Check questions to avoid duplicates
|
|
4156
4156
|
var submittedKnowledgeChecks = {};
|
|
4157
|
+
var kcQuestionCounter = 0;
|
|
4157
4158
|
|
|
4158
4159
|
/**
|
|
4159
4160
|
* Set up interceptors specifically for Rise Knowledge Check blocks
|
|
@@ -4185,16 +4186,26 @@ function generateLrsBridgeCode(options) {
|
|
|
4185
4186
|
* Extract and send xAPI statement for a Knowledge Check submission
|
|
4186
4187
|
*/
|
|
4187
4188
|
function extractKnowledgeCheckResult(kcBlock) {
|
|
4188
|
-
// Get block ID for
|
|
4189
|
+
// Get block ID for context
|
|
4189
4190
|
var blockContainer = kcBlock.closest('[data-block-id]');
|
|
4190
4191
|
var blockId = blockContainer ? blockContainer.getAttribute('data-block-id') : null;
|
|
4191
4192
|
|
|
4193
|
+
// Get question text first \u2014 needed for per-question dedup key
|
|
4194
|
+
var questionText = '';
|
|
4195
|
+
var questionTextEl = kcBlock.querySelector('.quiz-card__title .fr-view, .quiz-card__title');
|
|
4196
|
+
if (questionTextEl) {
|
|
4197
|
+
questionText = questionTextEl.textContent.trim();
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4192
4200
|
// Get question ID from the title element
|
|
4193
4201
|
var questionTitleEl = kcBlock.querySelector('.quiz-card__title');
|
|
4194
|
-
var questionId = questionTitleEl ? questionTitleEl.id :
|
|
4202
|
+
var questionId = questionTitleEl ? questionTitleEl.id : null;
|
|
4203
|
+
|
|
4204
|
+
// Build a question-specific dedup key using question text hash
|
|
4205
|
+
// This ensures each question in a multi-question quiz block gets its own key
|
|
4206
|
+
var questionHash = questionText ? questionText.substring(0, 100) : (questionId || blockId || generateUUID());
|
|
4207
|
+
var submissionKey = 'kc-' + questionHash;
|
|
4195
4208
|
|
|
4196
|
-
// Check if we already processed this submission (avoid duplicates)
|
|
4197
|
-
var submissionKey = blockId || questionId;
|
|
4198
4209
|
var feedbackLabel = kcBlock.querySelector('.quiz-card__feedback-label');
|
|
4199
4210
|
if (!feedbackLabel) {
|
|
4200
4211
|
log('Knowledge Check: No feedback visible yet');
|
|
@@ -4210,11 +4221,9 @@ function generateLrsBridgeCode(options) {
|
|
|
4210
4221
|
}
|
|
4211
4222
|
submittedKnowledgeChecks[submissionId] = true;
|
|
4212
4223
|
|
|
4213
|
-
//
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
if (questionTextEl) {
|
|
4217
|
-
questionText = questionTextEl.textContent.trim();
|
|
4224
|
+
// Use question-specific ID for the statement (not the shared block ID)
|
|
4225
|
+
if (!questionId) {
|
|
4226
|
+
questionId = blockId ? 'q-' + blockId + '-' + questionHash.substring(0, 20) : 'q-' + generateUUID();
|
|
4218
4227
|
}
|
|
4219
4228
|
|
|
4220
4229
|
// Determine question type from aria-label
|
|
@@ -4243,11 +4252,14 @@ function generateLrsBridgeCode(options) {
|
|
|
4243
4252
|
correct: isCorrect
|
|
4244
4253
|
});
|
|
4245
4254
|
|
|
4255
|
+
// Increment question counter for this session
|
|
4256
|
+
kcQuestionCounter++;
|
|
4257
|
+
|
|
4246
4258
|
// Send question answered statement using existing LRS method
|
|
4247
4259
|
LRS.questionAnswered({
|
|
4248
4260
|
questionId: questionId,
|
|
4249
4261
|
questionGuid: blockId || generateUUID(),
|
|
4250
|
-
questionNumber:
|
|
4262
|
+
questionNumber: kcQuestionCounter,
|
|
4251
4263
|
questionText: questionText.substring(0, 500),
|
|
4252
4264
|
questionType: questionType,
|
|
4253
4265
|
answer: answerText.substring(0, 500),
|