@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.
@@ -1229,19 +1229,20 @@ var init_elo = __esm({
1229
1229
  const scored = newCards.map((c, i) => {
1230
1230
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1231
1231
  const distance = Math.abs(cardElo - userGlobalElo);
1232
- const score = Math.max(0, 1 - distance / 500);
1232
+ const rawScore = Math.max(0, 1 - distance / 500);
1233
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1233
1234
  return {
1234
1235
  cardId: c.cardID,
1235
1236
  courseId: c.courseID,
1236
- score,
1237
+ score: samplingKey,
1237
1238
  provenance: [
1238
1239
  {
1239
1240
  strategy: "elo",
1240
1241
  strategyName: this.strategyName || this.name,
1241
1242
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1242
1243
  action: "generated",
1243
- score,
1244
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1244
+ score: samplingKey,
1245
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1245
1246
  }
1246
1247
  ]
1247
1248
  };