@vue-skuilder/standalone-ui 0.2.13 → 0.2.14

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.
@@ -31083,47 +31083,60 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31083
31083
  }
31084
31084
  async updateUserAndCardElo(t, c, u, d, m, g) {
31085
31085
  g && logger.warn("k value interpretation not currently implemented");
31086
- let b = this.dataLayer.getCourseDB(m.card.course_id), S = toCourseElo(d.courses.find((t) => t.courseID === c).elo), C = (await b.getCardEloData([m.card.card_id]))[0];
31087
- if (C && S) {
31088
- let m = adjustCourseScores(S, C, t);
31089
- d.courses.find((t) => t.courseID === c).elo = m.userElo;
31090
- let g = await Promise.allSettled([this.user.updateUserElo(c, m.userElo), b.updateCardElo(u, m.cardElo)]), w = g[0].status === "fulfilled", T = g[1].status === "fulfilled";
31091
- if (w && T) {
31092
- let t = g[0].value, c = g[1].value;
31086
+ let b = this.dataLayer.getCourseDB(m.card.course_id), S = d.courses.find((t) => t.courseID === c);
31087
+ if (!S) {
31088
+ logger.error(`[EloService] No registration for course ${c} on user's registration doc \u2014 skipping ELO update for card ${u}. (Is the user registered for this course?)`);
31089
+ return;
31090
+ }
31091
+ let C = toCourseElo(S.elo), w = (await b.getCardEloData([m.card.card_id]))[0];
31092
+ if (w && C) {
31093
+ let d = adjustCourseScores(C, w, t);
31094
+ S.elo = d.userElo;
31095
+ let m = await Promise.allSettled([this.user.updateUserElo(c, d.userElo), b.updateCardElo(u, d.cardElo)]), g = m[0].status === "fulfilled", T = m[1].status === "fulfilled";
31096
+ if (g && T) {
31097
+ let t = m[0].value, c = m[1].value;
31093
31098
  t.ok && c && c.ok && logger.info(`[EloService] Updated ELOS:
31094
- User: ${JSON.stringify(m.userElo)})
31095
- Card: ${JSON.stringify(m.cardElo)})
31099
+ User: ${JSON.stringify(d.userElo)})
31100
+ Card: ${JSON.stringify(d.cardElo)})
31096
31101
  `);
31097
31102
  } else logger.warn(`[EloService] Partial ELO update:
31098
- User ELO update: ${w ? "SUCCESS" : "FAILED"}
31099
- Card ELO update: ${T ? "SUCCESS" : "FAILED"}`), !w && g[0].status === "rejected" && logger.error("[EloService] User ELO update error:", g[0].reason), !T && g[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", g[1].reason);
31103
+ User ELO update: ${g ? "SUCCESS" : "FAILED"}
31104
+ Card ELO update: ${T ? "SUCCESS" : "FAILED"}`), !g && m[0].status === "rejected" && logger.error("[EloService] User ELO update error:", m[0].reason), !T && m[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", m[1].reason);
31100
31105
  }
31101
31106
  }
31102
31107
  async updateUserAndCardEloPerTag(t, c, u, d, m) {
31103
- let g = this.dataLayer.getCourseDB(m.card.course_id), b = toCourseElo(d.courses.find((t) => t.courseID === c).elo), [S, C] = await Promise.all([g.getCardEloData([m.card.card_id]), g.getAppliedTagsBatch([u])]), w = S[0], T = C.get(u) ?? [], E = { ...t }, D = t._global;
31104
- for (let t of T) t in E || (E[t] = D);
31105
- if (w && b) {
31106
- let t = adjustCourseScoresPerTag(b, w, E);
31107
- d.courses.find((t) => t.courseID === c).elo = t.userElo;
31108
- let m = await Promise.allSettled([this.user.updateUserElo(c, t.userElo), g.updateCardElo(u, t.cardElo)]), S = m[0].status === "fulfilled", C = m[1].status === "fulfilled";
31109
- if (S && C) {
31110
- let c = m[0].value, u = m[1].value;
31108
+ let g = this.dataLayer.getCourseDB(m.card.course_id), b = d.courses.find((t) => t.courseID === c);
31109
+ if (!b) {
31110
+ logger.error(`[EloService] No registration for course ${c} on user's registration doc \u2014 skipping per-tag ELO update for card ${u}. (Is the user registered for this course?)`);
31111
+ return;
31112
+ }
31113
+ let S = toCourseElo(b.elo), [C, w] = await Promise.all([g.getCardEloData([m.card.card_id]), g.getAppliedTagsBatch([u])]), T = C[0], E = w.get(u) ?? [], D = { ...t }, O = t._global;
31114
+ for (let t of E) t in D || (D[t] = O);
31115
+ if (T && S) {
31116
+ let t = adjustCourseScoresPerTag(S, T, D);
31117
+ b.elo = t.userElo;
31118
+ let d = await Promise.allSettled([this.user.updateUserElo(c, t.userElo), g.updateCardElo(u, t.cardElo)]), m = d[0].status === "fulfilled", C = d[1].status === "fulfilled";
31119
+ if (m && C) {
31120
+ let c = d[0].value, u = d[1].value;
31111
31121
  if (c.ok && u && u.ok) {
31112
- let c = Object.keys(E).length - 1;
31122
+ let c = Object.keys(D).length - 1;
31113
31123
  logger.info(`[EloService] Updated ELOS (per-tag, ${c} tags):
31114
31124
  User: ${JSON.stringify(t.userElo)})
31115
31125
  Card: ${JSON.stringify(t.cardElo)})
31116
31126
  `);
31117
31127
  }
31118
31128
  } else logger.warn(`[EloService] Partial ELO update (per-tag):
31119
- User ELO update: ${S ? "SUCCESS" : "FAILED"}
31120
- Card ELO update: ${C ? "SUCCESS" : "FAILED"}`), !S && m[0].status === "rejected" && logger.error("[EloService] User ELO update error:", m[0].reason), !C && m[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", m[1].reason);
31129
+ User ELO update: ${m ? "SUCCESS" : "FAILED"}
31130
+ Card ELO update: ${C ? "SUCCESS" : "FAILED"}`), !m && d[0].status === "rejected" && logger.error("[EloService] User ELO update error:", d[0].reason), !C && d[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", d[1].reason);
31121
31131
  }
31122
31132
  }
31123
31133
  }, init_core(), init_logger(), ResponseProcessor = class {
31124
31134
  constructor(t, c) {
31125
31135
  _defineProperty$2(this, "srsService", void 0), _defineProperty$2(this, "eloService", void 0), this.srsService = t, this.eloService = c;
31126
31136
  }
31137
+ logEloFailure(t, c) {
31138
+ return (u) => logger.error(`[ResponseProcessor] ELO update failed (${t}) for ${c}:`, u);
31139
+ }
31127
31140
  parsePerformance(t) {
31128
31141
  return typeof t == "number" ? {
31129
31142
  globalScore: t,
@@ -31163,13 +31176,13 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31163
31176
  let { globalScore: S, taggedPerformance: C } = this.parsePerformance(t.performance);
31164
31177
  if (C) {
31165
31178
  let u = Object.keys(C).filter((t) => t !== "_global"), S = u.filter((t) => C[t] === null), w = u.filter((t) => C[t] !== null);
31166
- logger.info(`[FirstContactElo] correct first-attempt per-tag ELO update for ${b} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}): scored=[${w.join(", ")}] count-only=[${S.join(", ")}]`), this.eloService.updateUserAndCardEloPerTag(C, g, b, d, m);
31179
+ logger.info(`[FirstContactElo] correct first-attempt per-tag ELO update for ${b} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}): scored=[${w.join(", ")}] count-only=[${S.join(", ")}]`), this.eloService.updateUserAndCardEloPerTag(C, g, b, d, m).catch(this.logEloFailure("correct per-tag", b));
31167
31180
  } else {
31168
31181
  let u = .5 + S / 2;
31169
- if (c.records.length === 1) this.eloService.updateUserAndCardElo(u, g, b, d, m);
31182
+ if (c.records.length === 1) this.eloService.updateUserAndCardElo(u, g, b, d, m).catch(this.logEloFailure("correct", b));
31170
31183
  else {
31171
31184
  let t = Math.ceil(32 / c.records.length);
31172
- this.eloService.updateUserAndCardElo(u, g, b, d, m, t);
31185
+ this.eloService.updateUserAndCardElo(u, g, b, d, m, t).catch(this.logEloFailure("correct repeat-view", b));
31173
31186
  }
31174
31187
  logger.info(`[FirstContactElo] correct first-attempt ELO update (score=${u.toFixed(3)}) for ${b} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`);
31175
31188
  }
@@ -31194,7 +31207,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31194
31207
  }
31195
31208
  processIncorrectResponse(t, c, u, d, m, g, b, S, C) {
31196
31209
  let { taggedPerformance: w } = this.parsePerformance(t.performance), T = !1;
31197
- return t.priorAttemps === 0 ? (w ? (this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d), logger.info(`[FirstContactElo] incorrect first-attempt per-tag ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}, tags=${Object.keys(w).length - 1})`)) : (this.eloService.updateUserAndCardElo(0, m, g, u, d), logger.info(`[FirstContactElo] incorrect first-attempt ELO update (score=0) for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`)), T = !0) : logger.info(`[FirstContactElo] incorrect retry \u2014 no ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`), d.records.length >= b ? C >= S ? (T ? logger.info(`[FirstContactElo] dismiss-failed \u2014 ELO already updated this response, skipping double penalty for ${g}`) : (w ? this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d) : this.eloService.updateUserAndCardElo(0, m, g, u, d), logger.info(`[FirstContactElo] dismiss-failed final ELO penalty for ${g} (historyLen=${c.records.length}, sessionViews=${C})`)), {
31210
+ return t.priorAttemps === 0 ? (w ? (this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d).catch(this.logEloFailure("incorrect per-tag", g)), logger.info(`[FirstContactElo] incorrect first-attempt per-tag ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}, tags=${Object.keys(w).length - 1})`)) : (this.eloService.updateUserAndCardElo(0, m, g, u, d).catch(this.logEloFailure("incorrect", g)), logger.info(`[FirstContactElo] incorrect first-attempt ELO update (score=0) for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`)), T = !0) : logger.info(`[FirstContactElo] incorrect retry \u2014 no ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`), d.records.length >= b ? C >= S ? (T ? logger.info(`[FirstContactElo] dismiss-failed \u2014 ELO already updated this response, skipping double penalty for ${g}`) : (w ? this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d).catch(this.logEloFailure("dismiss-failed per-tag", g)) : this.eloService.updateUserAndCardElo(0, m, g, u, d).catch(this.logEloFailure("dismiss-failed", g)), logger.info(`[FirstContactElo] dismiss-failed final ELO penalty for ${g} (historyLen=${c.records.length}, sessionViews=${C})`)), {
31198
31211
  nextCardAction: "dismiss-failed",
31199
31212
  shouldLoadNextCard: !0,
31200
31213
  isCorrect: !1,
@@ -43497,11 +43510,14 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
43497
43510
  }), Wt = {
43498
43511
  key: 0,
43499
43512
  class: "StudySession"
43500
- }, Gt = { key: 2 }, Kt = { key: 3 }, qt = { class: "text-h4" }, Jt = { key: 0 }, Yt = {
43513
+ }, Gt = { key: 2 }, Kt = {
43514
+ key: 3,
43515
+ class: "session-finished-area"
43516
+ }, qt = { class: "text-h4" }, Jt = { key: 0 }, Yt = {
43501
43517
  key: 4,
43502
43518
  ref: "shadowWrapper",
43503
43519
  class: "card-transition-container"
43504
- }, Xt = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), Zt = /* @__PURE__ */ F$3(Ut, [["render", _sfc_render$15], ["__scopeId", "data-v-0279250f"]]), Qt = /* @__PURE__ */ defineComponent({
43520
+ }, Xt = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), Zt = /* @__PURE__ */ F$3(Ut, [["render", _sfc_render$15], ["__scopeId", "data-v-1f4b2d6a"]]), Qt = /* @__PURE__ */ defineComponent({
43505
43521
  name: "MultipleChoiceOption",
43506
43522
  components: { MarkdownRenderer: /* @__PURE__ */ defineAsyncComponent(() => Promise.resolve().then(() => (init_MarkdownRenderer_kStoDRNE(), MarkdownRenderer_kStoDRNE_exports)).then((t) => t.n)) },
43507
43523
  props: {