@playcademy/vite-plugin 1.0.1-beta.3 → 1.0.1-beta.4
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.js +13 -57
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23746,7 +23746,7 @@ import path from "node:path";
|
|
|
23746
23746
|
// package.json
|
|
23747
23747
|
var package_default = {
|
|
23748
23748
|
name: "@playcademy/vite-plugin",
|
|
23749
|
-
version: "1.0.1-beta.
|
|
23749
|
+
version: "1.0.1-beta.4",
|
|
23750
23750
|
type: "module",
|
|
23751
23751
|
exports: {
|
|
23752
23752
|
".": {
|
|
@@ -25194,7 +25194,7 @@ var package_default2;
|
|
|
25194
25194
|
var init_package = __esm(() => {
|
|
25195
25195
|
package_default2 = {
|
|
25196
25196
|
name: "@playcademy/sandbox",
|
|
25197
|
-
version: "0.5.1-beta.
|
|
25197
|
+
version: "0.5.1-beta.4",
|
|
25198
25198
|
description: "Local development server for Playcademy game development",
|
|
25199
25199
|
type: "module",
|
|
25200
25200
|
exports: {
|
|
@@ -55919,44 +55919,6 @@ function validateSessionData(sessionData) {
|
|
|
55919
55919
|
throw new ConfigurationError("sensorUrl", 'Sensor URL is required for Caliper events. Provide it in sessionData.sensorUrl (e.g., "https://hub.playcademy.net/p/your-game")');
|
|
55920
55920
|
}
|
|
55921
55921
|
}
|
|
55922
|
-
function getAttemptMultiplier(attemptNumber) {
|
|
55923
|
-
switch (attemptNumber) {
|
|
55924
|
-
case 1: {
|
|
55925
|
-
return 1;
|
|
55926
|
-
}
|
|
55927
|
-
case 2: {
|
|
55928
|
-
return 0.5;
|
|
55929
|
-
}
|
|
55930
|
-
case 3: {
|
|
55931
|
-
return 0.25;
|
|
55932
|
-
}
|
|
55933
|
-
default: {
|
|
55934
|
-
return 0;
|
|
55935
|
-
}
|
|
55936
|
-
}
|
|
55937
|
-
}
|
|
55938
|
-
function getAccuracyMultiplier(accuracy) {
|
|
55939
|
-
if (!Number.isFinite(accuracy) || accuracy < 0) {
|
|
55940
|
-
return 0;
|
|
55941
|
-
}
|
|
55942
|
-
if (accuracy >= PERFECT_ACCURACY_THRESHOLD) {
|
|
55943
|
-
return 1.25;
|
|
55944
|
-
} else if (accuracy >= 0.8) {
|
|
55945
|
-
return 1;
|
|
55946
|
-
} else {
|
|
55947
|
-
return 0;
|
|
55948
|
-
}
|
|
55949
|
-
}
|
|
55950
|
-
function calculateXp(durationSeconds, accuracy, attemptNumber) {
|
|
55951
|
-
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
|
|
55952
|
-
return 0;
|
|
55953
|
-
}
|
|
55954
|
-
const durationMinutes = durationSeconds / 60;
|
|
55955
|
-
const baseXp = Number(durationMinutes);
|
|
55956
|
-
const accuracyMultiplier = getAccuracyMultiplier(accuracy);
|
|
55957
|
-
const attemptMultiplier = getAttemptMultiplier(attemptNumber);
|
|
55958
|
-
return Math.round(baseXp * accuracyMultiplier * attemptMultiplier * 10) / 10;
|
|
55959
|
-
}
|
|
55960
55922
|
|
|
55961
55923
|
class ProgressRecorder {
|
|
55962
55924
|
studentResolver;
|
|
@@ -55975,10 +55937,15 @@ class ProgressRecorder {
|
|
|
55975
55937
|
validateProgressData(progressData);
|
|
55976
55938
|
const { ids, activityId, activityName, courseName, student } = await this.resolveContext(courseId, studentIdentifier, progressData);
|
|
55977
55939
|
const { id: studentId, email: studentEmail } = student;
|
|
55978
|
-
const {
|
|
55940
|
+
const {
|
|
55941
|
+
score,
|
|
55942
|
+
totalQuestions,
|
|
55943
|
+
correctQuestions,
|
|
55944
|
+
xpEarned = 0,
|
|
55945
|
+
attemptNumber
|
|
55946
|
+
} = progressData;
|
|
55979
55947
|
const actualLineItemId = await this.resolveAssessmentLineItem(activityId, activityName, progressData.classId, ids);
|
|
55980
55948
|
const currentAttemptNumber = await this.resolveAttemptNumber(attemptNumber, score, studentId, actualLineItemId);
|
|
55981
|
-
const calculatedXp = this.calculateXpForProgress(progressData, totalQuestions, correctQuestions, xpEarned, currentAttemptNumber);
|
|
55982
55949
|
let extensions = progressData.extensions;
|
|
55983
55950
|
const masteryProgress = await this.masteryTracker.checkProgress({
|
|
55984
55951
|
studentId,
|
|
@@ -56009,7 +55976,7 @@ class ProgressRecorder {
|
|
|
56009
55976
|
studentId,
|
|
56010
55977
|
attemptNumber: currentAttemptNumber,
|
|
56011
55978
|
score,
|
|
56012
|
-
xp:
|
|
55979
|
+
xp: xpEarned,
|
|
56013
55980
|
scoreStatus,
|
|
56014
55981
|
inProgress,
|
|
56015
55982
|
appName: progressData.appName,
|
|
@@ -56048,7 +56015,7 @@ class ProgressRecorder {
|
|
|
56048
56015
|
courseName,
|
|
56049
56016
|
totalQuestions,
|
|
56050
56017
|
correctQuestions,
|
|
56051
|
-
xpEarned
|
|
56018
|
+
xpEarned,
|
|
56052
56019
|
masteredUnits: effectiveMasteredUnits || undefined,
|
|
56053
56020
|
attemptNumber: currentAttemptNumber,
|
|
56054
56021
|
progressData,
|
|
@@ -56056,7 +56023,7 @@ class ProgressRecorder {
|
|
|
56056
56023
|
runId: progressData.runId
|
|
56057
56024
|
});
|
|
56058
56025
|
return {
|
|
56059
|
-
xpAwarded:
|
|
56026
|
+
xpAwarded: xpEarned,
|
|
56060
56027
|
attemptNumber: currentAttemptNumber,
|
|
56061
56028
|
masteredUnitsApplied: effectiveMasteredUnits,
|
|
56062
56029
|
pctCompleteApp,
|
|
@@ -56090,16 +56057,6 @@ class ProgressRecorder {
|
|
|
56090
56057
|
}
|
|
56091
56058
|
return 1;
|
|
56092
56059
|
}
|
|
56093
|
-
calculateXpForProgress(progressData, totalQuestions, correctQuestions, xpEarned, attemptNumber) {
|
|
56094
|
-
if (xpEarned !== undefined) {
|
|
56095
|
-
return xpEarned;
|
|
56096
|
-
}
|
|
56097
|
-
if (progressData.durationSeconds && totalQuestions && correctQuestions) {
|
|
56098
|
-
const accuracy = correctQuestions / totalQuestions;
|
|
56099
|
-
return calculateXp(progressData.durationSeconds, accuracy, attemptNumber);
|
|
56100
|
-
}
|
|
56101
|
-
return 0;
|
|
56102
|
-
}
|
|
56103
56060
|
async getOrCreateLineItem(lineItemId, activityName, classId, ids) {
|
|
56104
56061
|
try {
|
|
56105
56062
|
const lineItem = await this.onerosterNamespace.assessmentLineItems.findOrCreate(lineItemId, {
|
|
@@ -56802,7 +56759,6 @@ var GRADE_VALUES;
|
|
|
56802
56759
|
var TimebackAuthError;
|
|
56803
56760
|
var UUID_PATTERN;
|
|
56804
56761
|
var storage;
|
|
56805
|
-
var PERFECT_ACCURACY_THRESHOLD = 0.999999;
|
|
56806
56762
|
var EmailSchema;
|
|
56807
56763
|
var StudentSourcedIdSchema;
|
|
56808
56764
|
var StudentIdentifierSchema;
|
|
@@ -58469,7 +58425,7 @@ var init_schemas4 = __esm(() => {
|
|
|
58469
58425
|
activeSeconds: exports_external.number().nonnegative(),
|
|
58470
58426
|
inactiveSeconds: exports_external.number().nonnegative().optional()
|
|
58471
58427
|
}).optional(),
|
|
58472
|
-
xpEarned: exports_external.number()
|
|
58428
|
+
xpEarned: exports_external.number(),
|
|
58473
58429
|
masteredUnits: exports_external.number().optional(),
|
|
58474
58430
|
masteredUnitsAbsolute: exports_external.number().int().nonnegative().optional(),
|
|
58475
58431
|
extensions: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|