@patch-adams/core 1.5.7 → 1.5.8
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 +30 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +30 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2684,15 +2684,37 @@ function generateLrsBridgeCode(options) {
|
|
|
2684
2684
|
* Build activity object for questions in Xyleme format
|
|
2685
2685
|
* Name format: "Assessment Name - Q#: Question text..."
|
|
2686
2686
|
*/
|
|
2687
|
+
/**
|
|
2688
|
+
* Simple string hash for generating short, stable IDs from long strings.
|
|
2689
|
+
* Returns a hex string (8 chars). Not cryptographic \u2014 just for uniqueness.
|
|
2690
|
+
*/
|
|
2691
|
+
function hashString(str) {
|
|
2692
|
+
var hash = 0;
|
|
2693
|
+
for (var i = 0; i < str.length; i++) {
|
|
2694
|
+
var ch = str.charCodeAt(i);
|
|
2695
|
+
hash = ((hash << 5) - hash) + ch;
|
|
2696
|
+
hash = hash & hash; // Convert to 32-bit integer
|
|
2697
|
+
}
|
|
2698
|
+
return Math.abs(hash).toString(16).padStart(8, '0');
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2687
2701
|
function buildQuestionActivityObject(questionInfo) {
|
|
2688
|
-
var
|
|
2702
|
+
var rawGuid = questionInfo.questionGuid || questionInfo.id || generateUUID();
|
|
2703
|
+
|
|
2704
|
+
// Ensure the object ID stays under 255 chars total to avoid Bravais aggregation failures.
|
|
2705
|
+
// Rise SCORM interaction IDs can be very long (full slugified question text).
|
|
2706
|
+
// Use a truncated prefix + hash to keep it short but unique and stable.
|
|
2707
|
+
var questionGuid = rawGuid;
|
|
2708
|
+
if (rawGuid.length > 80) {
|
|
2709
|
+
questionGuid = rawGuid.substring(0, 60) + '_' + hashString(rawGuid);
|
|
2710
|
+
}
|
|
2689
2711
|
|
|
2690
2712
|
// Build human-readable display name
|
|
2691
2713
|
var displayName = (questionInfo.assessmentName || 'Knowledge Check');
|
|
2692
2714
|
if (questionInfo.questionNumber) {
|
|
2693
2715
|
displayName += ' - Q' + questionInfo.questionNumber;
|
|
2694
2716
|
}
|
|
2695
|
-
var questionText = questionInfo.text || questionInfo.questionText || '';
|
|
2717
|
+
var questionText = decodeEntities(questionInfo.text || questionInfo.questionText || '');
|
|
2696
2718
|
if (questionText.length > 50) {
|
|
2697
2719
|
displayName += ': ' + questionText.substring(0, 47) + '...';
|
|
2698
2720
|
} else if (questionText.length > 0) {
|
|
@@ -4069,10 +4091,12 @@ function generateLrsBridgeCode(options) {
|
|
|
4069
4091
|
var interactionId = interaction.id || ('interaction-' + idx);
|
|
4070
4092
|
|
|
4071
4093
|
// Try to make a readable question text from the interaction ID
|
|
4072
|
-
var questionText =
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4094
|
+
var questionText = decodeEntities(
|
|
4095
|
+
interactionId
|
|
4096
|
+
.replace(/_\\d+$/, '') // remove trailing _0
|
|
4097
|
+
.replace(/_/g, ' ') // underscores to spaces
|
|
4098
|
+
.substring(0, 200)
|
|
4099
|
+
);
|
|
4076
4100
|
|
|
4077
4101
|
// Get lesson context
|
|
4078
4102
|
var lessonInfo = getCachedLessonInfo();
|