@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.js CHANGED
@@ -1382,19 +1382,20 @@ var init_elo = __esm({
1382
1382
  const scored = newCards.map((c, i) => {
1383
1383
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1384
1384
  const distance = Math.abs(cardElo - userGlobalElo);
1385
- const score = Math.max(0, 1 - distance / 500);
1385
+ const rawScore = Math.max(0, 1 - distance / 500);
1386
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1386
1387
  return {
1387
1388
  cardId: c.cardID,
1388
1389
  courseId: c.courseID,
1389
- score,
1390
+ score: samplingKey,
1390
1391
  provenance: [
1391
1392
  {
1392
1393
  strategy: "elo",
1393
1394
  strategyName: this.strategyName || this.name,
1394
1395
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1395
1396
  action: "generated",
1396
- score,
1397
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1397
+ score: samplingKey,
1398
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1398
1399
  }
1399
1400
  ]
1400
1401
  };