@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/index.cjs
CHANGED
|
@@ -3819,8 +3819,9 @@ function generateLrsBridgeCode(options) {
|
|
|
3819
3819
|
});
|
|
3820
3820
|
}
|
|
3821
3821
|
|
|
3822
|
-
// Track submitted Knowledge Check
|
|
3822
|
+
// Track submitted Knowledge Check questions to avoid duplicates
|
|
3823
3823
|
var submittedKnowledgeChecks = {};
|
|
3824
|
+
var kcQuestionCounter = 0;
|
|
3824
3825
|
|
|
3825
3826
|
/**
|
|
3826
3827
|
* Set up interceptors specifically for Rise Knowledge Check blocks
|
|
@@ -3852,16 +3853,26 @@ function generateLrsBridgeCode(options) {
|
|
|
3852
3853
|
* Extract and send xAPI statement for a Knowledge Check submission
|
|
3853
3854
|
*/
|
|
3854
3855
|
function extractKnowledgeCheckResult(kcBlock) {
|
|
3855
|
-
// Get block ID for
|
|
3856
|
+
// Get block ID for context
|
|
3856
3857
|
var blockContainer = kcBlock.closest('[data-block-id]');
|
|
3857
3858
|
var blockId = blockContainer ? blockContainer.getAttribute('data-block-id') : null;
|
|
3858
3859
|
|
|
3860
|
+
// Get question text first \u2014 needed for per-question dedup key
|
|
3861
|
+
var questionText = '';
|
|
3862
|
+
var questionTextEl = kcBlock.querySelector('.quiz-card__title .fr-view, .quiz-card__title');
|
|
3863
|
+
if (questionTextEl) {
|
|
3864
|
+
questionText = questionTextEl.textContent.trim();
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3859
3867
|
// Get question ID from the title element
|
|
3860
3868
|
var questionTitleEl = kcBlock.querySelector('.quiz-card__title');
|
|
3861
|
-
var questionId = questionTitleEl ? questionTitleEl.id :
|
|
3869
|
+
var questionId = questionTitleEl ? questionTitleEl.id : null;
|
|
3870
|
+
|
|
3871
|
+
// Build a question-specific dedup key using question text hash
|
|
3872
|
+
// This ensures each question in a multi-question quiz block gets its own key
|
|
3873
|
+
var questionHash = questionText ? questionText.substring(0, 100) : (questionId || blockId || generateUUID());
|
|
3874
|
+
var submissionKey = 'kc-' + questionHash;
|
|
3862
3875
|
|
|
3863
|
-
// Check if we already processed this submission (avoid duplicates)
|
|
3864
|
-
var submissionKey = blockId || questionId;
|
|
3865
3876
|
var feedbackLabel = kcBlock.querySelector('.quiz-card__feedback-label');
|
|
3866
3877
|
if (!feedbackLabel) {
|
|
3867
3878
|
log('Knowledge Check: No feedback visible yet');
|
|
@@ -3877,11 +3888,9 @@ function generateLrsBridgeCode(options) {
|
|
|
3877
3888
|
}
|
|
3878
3889
|
submittedKnowledgeChecks[submissionId] = true;
|
|
3879
3890
|
|
|
3880
|
-
//
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
if (questionTextEl) {
|
|
3884
|
-
questionText = questionTextEl.textContent.trim();
|
|
3891
|
+
// Use question-specific ID for the statement (not the shared block ID)
|
|
3892
|
+
if (!questionId) {
|
|
3893
|
+
questionId = blockId ? 'q-' + blockId + '-' + questionHash.substring(0, 20) : 'q-' + generateUUID();
|
|
3885
3894
|
}
|
|
3886
3895
|
|
|
3887
3896
|
// Determine question type from aria-label
|
|
@@ -3910,11 +3919,14 @@ function generateLrsBridgeCode(options) {
|
|
|
3910
3919
|
correct: isCorrect
|
|
3911
3920
|
});
|
|
3912
3921
|
|
|
3922
|
+
// Increment question counter for this session
|
|
3923
|
+
kcQuestionCounter++;
|
|
3924
|
+
|
|
3913
3925
|
// Send question answered statement using existing LRS method
|
|
3914
3926
|
LRS.questionAnswered({
|
|
3915
3927
|
questionId: questionId,
|
|
3916
3928
|
questionGuid: blockId || generateUUID(),
|
|
3917
|
-
questionNumber:
|
|
3929
|
+
questionNumber: kcQuestionCounter,
|
|
3918
3930
|
questionText: questionText.substring(0, 500),
|
|
3919
3931
|
questionType: questionType,
|
|
3920
3932
|
answer: answerText.substring(0, 500),
|