@vue-skuilder/db 0.1.29 → 0.1.31-a

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
@@ -1359,19 +1359,20 @@ var init_elo = __esm({
1359
1359
  const scored = newCards.map((c, i) => {
1360
1360
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1361
1361
  const distance = Math.abs(cardElo - userGlobalElo);
1362
- const score = Math.max(0, 1 - distance / 500);
1362
+ const rawScore = Math.max(0, 1 - distance / 500);
1363
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1363
1364
  return {
1364
1365
  cardId: c.cardID,
1365
1366
  courseId: c.courseID,
1366
- score,
1367
+ score: samplingKey,
1367
1368
  provenance: [
1368
1369
  {
1369
1370
  strategy: "elo",
1370
1371
  strategyName: this.strategyName || this.name,
1371
1372
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1372
1373
  action: "generated",
1373
- score,
1374
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1374
+ score: samplingKey,
1375
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1375
1376
  }
1376
1377
  ]
1377
1378
  };