@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.js CHANGED
@@ -6146,9 +6146,10 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
6146
6146
  return tagsByCard;
6147
6147
  }
6148
6148
  async getAllCardIds() {
6149
+ const prefix = `${DocTypePrefixes["CARD" /* CARD */]}-`;
6149
6150
  const result = await this.db.allDocs({
6150
- startkey: "CARD-",
6151
- endkey: "CARD-\uFFF0",
6151
+ startkey: prefix,
6152
+ endkey: `${prefix}\uFFF0`,
6152
6153
  include_docs: false
6153
6154
  });
6154
6155
  return result.rows.map((row) => row.id);
@@ -11314,7 +11315,7 @@ var ResponseProcessor = class {
11314
11315
  const nullTags = tagKeys.filter((k) => taggedPerformance[k] === null);
11315
11316
  const scoredTags = tagKeys.filter((k) => taggedPerformance[k] !== null);
11316
11317
  logger.info(
11317
- `[ResponseProcessor] per-tag ELO update for ${cardId}: scored=[${scoredTags.join(", ")}] count-only=[${nullTags.join(", ")}]`
11318
+ `[FirstContactElo] correct first-attempt per-tag ELO update for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps}): scored=[${scoredTags.join(", ")}] count-only=[${nullTags.join(", ")}]`
11318
11319
  );
11319
11320
  void this.eloService.updateUserAndCardEloPerTag(
11320
11321
  taggedPerformance,
@@ -11345,7 +11346,7 @@ var ResponseProcessor = class {
11345
11346
  );
11346
11347
  }
11347
11348
  logger.info(
11348
- "[ResponseProcessor] Processed correct response with SRS scheduling and ELO update"
11349
+ `[FirstContactElo] correct first-attempt ELO update (score=${userScore.toFixed(3)}) for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps})`
11349
11350
  );
11350
11351
  }
11351
11352
  return {
@@ -11374,7 +11375,8 @@ var ResponseProcessor = class {
11374
11375
  */
11375
11376
  processIncorrectResponse(cardRecord, history, courseRegistrationDoc, currentCard, courseId, cardId, maxAttemptsPerView, maxSessionViews, sessionViews) {
11376
11377
  const { taggedPerformance } = this.parsePerformance(cardRecord.performance);
11377
- if (history.records.length !== 1 && cardRecord.priorAttemps === 0) {
11378
+ let eloUpdated = false;
11379
+ if (cardRecord.priorAttemps === 0) {
11378
11380
  if (taggedPerformance) {
11379
11381
  void this.eloService.updateUserAndCardEloPerTag(
11380
11382
  taggedPerformance,
@@ -11384,7 +11386,7 @@ var ResponseProcessor = class {
11384
11386
  currentCard
11385
11387
  );
11386
11388
  logger.info(
11387
- `[ResponseProcessor] Processed incorrect response with per-tag ELO update (${Object.keys(taggedPerformance).length - 1} tags)`
11389
+ `[FirstContactElo] incorrect first-attempt per-tag ELO update for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps}, tags=${Object.keys(taggedPerformance).length - 1})`
11388
11390
  );
11389
11391
  } else {
11390
11392
  void this.eloService.updateUserAndCardElo(
@@ -11395,28 +11397,42 @@ var ResponseProcessor = class {
11395
11397
  courseRegistrationDoc,
11396
11398
  currentCard
11397
11399
  );
11398
- logger.info("[ResponseProcessor] Processed incorrect response with ELO update");
11400
+ logger.info(
11401
+ `[FirstContactElo] incorrect first-attempt ELO update (score=0) for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps})`
11402
+ );
11399
11403
  }
11404
+ eloUpdated = true;
11400
11405
  } else {
11401
- logger.info("[ResponseProcessor] Processed incorrect response (no ELO update needed)");
11406
+ logger.info(
11407
+ `[FirstContactElo] incorrect retry \u2014 no ELO update for ${cardId} (historyLen=${history.records.length}, priorAttemps=${cardRecord.priorAttemps})`
11408
+ );
11402
11409
  }
11403
11410
  if (currentCard.records.length >= maxAttemptsPerView) {
11404
11411
  if (sessionViews >= maxSessionViews) {
11405
- if (taggedPerformance) {
11406
- void this.eloService.updateUserAndCardEloPerTag(
11407
- taggedPerformance,
11408
- courseId,
11409
- cardId,
11410
- courseRegistrationDoc,
11411
- currentCard
11412
+ if (!eloUpdated) {
11413
+ if (taggedPerformance) {
11414
+ void this.eloService.updateUserAndCardEloPerTag(
11415
+ taggedPerformance,
11416
+ courseId,
11417
+ cardId,
11418
+ courseRegistrationDoc,
11419
+ currentCard
11420
+ );
11421
+ } else {
11422
+ void this.eloService.updateUserAndCardElo(
11423
+ 0,
11424
+ courseId,
11425
+ cardId,
11426
+ courseRegistrationDoc,
11427
+ currentCard
11428
+ );
11429
+ }
11430
+ logger.info(
11431
+ `[FirstContactElo] dismiss-failed final ELO penalty for ${cardId} (historyLen=${history.records.length}, sessionViews=${sessionViews})`
11412
11432
  );
11413
11433
  } else {
11414
- void this.eloService.updateUserAndCardElo(
11415
- 0,
11416
- courseId,
11417
- cardId,
11418
- courseRegistrationDoc,
11419
- currentCard
11434
+ logger.info(
11435
+ `[FirstContactElo] dismiss-failed \u2014 ELO already updated this response, skipping double penalty for ${cardId}`
11420
11436
  );
11421
11437
  }
11422
11438
  return {