@playcademy/vite-plugin 0.2.26-beta.5 → 0.2.26-beta.6

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.
Files changed (2) hide show
  1. package/dist/index.js +50 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25370,7 +25370,7 @@ var package_default;
25370
25370
  var init_package = __esm(() => {
25371
25371
  package_default = {
25372
25372
  name: "@playcademy/sandbox",
25373
- version: "0.3.17-beta.20",
25373
+ version: "0.3.17-beta.21",
25374
25374
  description: "Local development server for Playcademy game development",
25375
25375
  type: "module",
25376
25376
  exports: {
@@ -60133,7 +60133,7 @@ class MasteryTracker {
60133
60133
  }
60134
60134
  async checkProgress(input) {
60135
60135
  const { studentId, courseId, resourceId, masteredUnits } = input;
60136
- if (typeof masteredUnits !== "number" || masteredUnits <= 0) {
60136
+ if (typeof masteredUnits !== "number" || masteredUnits === 0) {
60137
60137
  return;
60138
60138
  }
60139
60139
  const status = await this.calculateStatus({
@@ -60145,9 +60145,11 @@ class MasteryTracker {
60145
60145
  if (!status) {
60146
60146
  return;
60147
60147
  }
60148
+ const wasComplete = status.historicalMasteredUnits >= status.masterableUnits;
60148
60149
  return {
60149
60150
  pctCompleteApp: status.pctCompleteApp,
60150
- masteryAchieved: status.historicalMasteredUnits < status.masterableUnits && status.isComplete
60151
+ masteryAchieved: !wasComplete && status.isComplete,
60152
+ masteryRevoked: wasComplete && !status.isComplete
60151
60153
  };
60152
60154
  }
60153
60155
  async getStatus(input) {
@@ -60188,7 +60190,7 @@ class MasteryTracker {
60188
60190
  return;
60189
60191
  }
60190
60192
  const historicalMasteredUnits = this.sumAnalyticsMetric(facts, "masteredUnits");
60191
- const totalMastered = historicalMasteredUnits + additionalMasteredUnits;
60193
+ const totalMastered = Math.max(0, historicalMasteredUnits + additionalMasteredUnits);
60192
60194
  const rawPct = totalMastered / masterableUnits * 100;
60193
60195
  const pctCompleteApp = Math.min(100, Math.max(0, Math.round(rawPct)));
60194
60196
  return {
@@ -60238,6 +60240,45 @@ class MasteryTracker {
60238
60240
  });
60239
60241
  }
60240
60242
  }
60243
+ async revokeCompletionEntry(studentId, courseId, classId, appName) {
60244
+ const ids = deriveSourcedIds2(courseId);
60245
+ const lineItemId = `${ids.course}-mastery-completion-assessment`;
60246
+ const resultId = `${lineItemId}:${studentId}:completion`;
60247
+ try {
60248
+ await this.onerosterNamespace.assessmentLineItems.findOrCreate(lineItemId, {
60249
+ sourcedId: lineItemId,
60250
+ title: "Mastery Completion",
60251
+ status: ONEROSTER_STATUS4.active,
60252
+ ...classId ? { class: { sourcedId: classId } } : { course: { sourcedId: ids.course } },
60253
+ ...ids.componentResource ? { componentResource: { sourcedId: ids.componentResource } } : {}
60254
+ });
60255
+ await this.onerosterNamespace.assessmentResults.upsert(resultId, {
60256
+ sourcedId: resultId,
60257
+ status: ONEROSTER_STATUS4.active,
60258
+ assessmentLineItem: { sourcedId: lineItemId },
60259
+ student: { sourcedId: studentId },
60260
+ score: 0,
60261
+ scoreDate: new Date().toISOString(),
60262
+ scoreStatus: SCORE_STATUS4.notSubmitted,
60263
+ inProgress: "true",
60264
+ metadata: {
60265
+ isMasteryCompletion: true,
60266
+ appName
60267
+ }
60268
+ });
60269
+ log.info("[MasteryTracker] Revoked mastery completion entry", {
60270
+ studentId,
60271
+ lineItemId,
60272
+ resultId
60273
+ });
60274
+ } catch (error) {
60275
+ log.error("[MasteryTracker] Failed to revoke mastery completion entry", {
60276
+ studentId,
60277
+ lineItemId,
60278
+ error
60279
+ });
60280
+ }
60281
+ }
60241
60282
  async resolveMasterableUnits(resourceId) {
60242
60283
  if (!resourceId) {
60243
60284
  return;
@@ -60447,6 +60488,9 @@ class ProgressRecorder {
60447
60488
  sensorUrl: progressData.sensorUrl
60448
60489
  });
60449
60490
  }
60491
+ if (masteryProgress?.masteryRevoked) {
60492
+ await this.masteryTracker.revokeCompletionEntry(studentId, courseId, progressData.classId, progressData.appName);
60493
+ }
60450
60494
  await this.emitCaliperEvent({
60451
60495
  studentId,
60452
60496
  studentEmail,
@@ -120742,7 +120786,7 @@ var init_schemas11 = __esm(() => {
120742
120786
  inactiveSeconds: exports_external.number().nonnegative().optional()
120743
120787
  }).optional(),
120744
120788
  xpEarned: exports_external.number().optional(),
120745
- masteredUnits: exports_external.number().nonnegative().optional(),
120789
+ masteredUnits: exports_external.number().optional(),
120746
120790
  extensions: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
120747
120791
  });
120748
120792
  AdvanceCourseRequestSchema = exports_external.object({
@@ -126369,7 +126413,7 @@ var import_picocolors12 = __toESM(require_picocolors(), 1);
126369
126413
  // package.json
126370
126414
  var package_default2 = {
126371
126415
  name: "@playcademy/vite-plugin",
126372
- version: "0.2.26-beta.5",
126416
+ version: "0.2.26-beta.6",
126373
126417
  type: "module",
126374
126418
  exports: {
126375
126419
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/vite-plugin",
3
- "version": "0.2.26-beta.5",
3
+ "version": "0.2.26-beta.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {