@vue-skuilder/db 0.2.9 → 0.2.11

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.mjs CHANGED
@@ -6128,9 +6128,10 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
6128
6128
  return tagsByCard;
6129
6129
  }
6130
6130
  async getAllCardIds() {
6131
+ const prefix = `${DocTypePrefixes["CARD" /* CARD */]}-`;
6131
6132
  const result = await this.db.allDocs({
6132
- startkey: "CARD-",
6133
- endkey: "CARD-\uFFF0",
6133
+ startkey: prefix,
6134
+ endkey: `${prefix}\uFFF0`,
6134
6135
  include_docs: false
6135
6136
  });
6136
6137
  return result.rows.map((row) => row.id);
@@ -11202,7 +11203,7 @@ var ResponseProcessor = class {
11202
11203
  const nullTags = tagKeys.filter((k) => taggedPerformance[k] === null);
11203
11204
  const scoredTags = tagKeys.filter((k) => taggedPerformance[k] !== null);
11204
11205
  logger.info(
11205
- `[ResponseProcessor] per-tag ELO update for ${cardId}: scored=[${scoredTags.join(", ")}] count-only=[${nullTags.join(", ")}]`
11206
+ `[FirstContactElo] correct first-attempt per-tag ELO update for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps}): scored=[${scoredTags.join(", ")}] count-only=[${nullTags.join(", ")}]`
11206
11207
  );
11207
11208
  void this.eloService.updateUserAndCardEloPerTag(
11208
11209
  taggedPerformance,
@@ -11233,7 +11234,7 @@ var ResponseProcessor = class {
11233
11234
  );
11234
11235
  }
11235
11236
  logger.info(
11236
- "[ResponseProcessor] Processed correct response with SRS scheduling and ELO update"
11237
+ `[FirstContactElo] correct first-attempt ELO update (score=${userScore.toFixed(3)}) for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps})`
11237
11238
  );
11238
11239
  }
11239
11240
  return {
@@ -11262,7 +11263,8 @@ var ResponseProcessor = class {
11262
11263
  */
11263
11264
  processIncorrectResponse(cardRecord, history, courseRegistrationDoc, currentCard, courseId, cardId, maxAttemptsPerView, maxSessionViews, sessionViews) {
11264
11265
  const { taggedPerformance } = this.parsePerformance(cardRecord.performance);
11265
- if (history.records.length !== 1 && cardRecord.priorAttemps === 0) {
11266
+ let eloUpdated = false;
11267
+ if (cardRecord.priorAttemps === 0) {
11266
11268
  if (taggedPerformance) {
11267
11269
  void this.eloService.updateUserAndCardEloPerTag(
11268
11270
  taggedPerformance,
@@ -11272,7 +11274,7 @@ var ResponseProcessor = class {
11272
11274
  currentCard
11273
11275
  );
11274
11276
  logger.info(
11275
- `[ResponseProcessor] Processed incorrect response with per-tag ELO update (${Object.keys(taggedPerformance).length - 1} tags)`
11277
+ `[FirstContactElo] incorrect first-attempt per-tag ELO update for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps}, tags=${Object.keys(taggedPerformance).length - 1})`
11276
11278
  );
11277
11279
  } else {
11278
11280
  void this.eloService.updateUserAndCardElo(
@@ -11283,28 +11285,42 @@ var ResponseProcessor = class {
11283
11285
  courseRegistrationDoc,
11284
11286
  currentCard
11285
11287
  );
11286
- logger.info("[ResponseProcessor] Processed incorrect response with ELO update");
11288
+ logger.info(
11289
+ `[FirstContactElo] incorrect first-attempt ELO update (score=0) for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps})`
11290
+ );
11287
11291
  }
11292
+ eloUpdated = true;
11288
11293
  } else {
11289
- logger.info("[ResponseProcessor] Processed incorrect response (no ELO update needed)");
11294
+ logger.info(
11295
+ `[FirstContactElo] incorrect retry \u2014 no ELO update for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps})`
11296
+ );
11290
11297
  }
11291
11298
  if (currentCard.records.length >= maxAttemptsPerView) {
11292
11299
  if (sessionViews >= maxSessionViews) {
11293
- if (taggedPerformance) {
11294
- void this.eloService.updateUserAndCardEloPerTag(
11295
- taggedPerformance,
11296
- courseId,
11297
- cardId,
11298
- courseRegistrationDoc,
11299
- currentCard
11300
+ if (!eloUpdated) {
11301
+ if (taggedPerformance) {
11302
+ void this.eloService.updateUserAndCardEloPerTag(
11303
+ taggedPerformance,
11304
+ courseId,
11305
+ cardId,
11306
+ courseRegistrationDoc,
11307
+ currentCard
11308
+ );
11309
+ } else {
11310
+ void this.eloService.updateUserAndCardElo(
11311
+ 0,
11312
+ courseId,
11313
+ cardId,
11314
+ courseRegistrationDoc,
11315
+ currentCard
11316
+ );
11317
+ }
11318
+ logger.info(
11319
+ `[FirstContactElo] dismiss-failed final ELO penalty for ${cardId} (historyLen=${history.records.length}, sessionViews=${sessionViews})`
11300
11320
  );
11301
11321
  } else {
11302
- void this.eloService.updateUserAndCardElo(
11303
- 0,
11304
- courseId,
11305
- cardId,
11306
- courseRegistrationDoc,
11307
- currentCard
11322
+ logger.info(
11323
+ `[FirstContactElo] dismiss-failed \u2014 ELO already updated this response, skipping double penalty for ${cardId}`
11308
11324
  );
11309
11325
  }
11310
11326
  return {