@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.
@@ -1206,19 +1206,20 @@ var init_elo = __esm({
1206
1206
  const scored = newCards.map((c, i) => {
1207
1207
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1208
1208
  const distance = Math.abs(cardElo - userGlobalElo);
1209
- const score = Math.max(0, 1 - distance / 500);
1209
+ const rawScore = Math.max(0, 1 - distance / 500);
1210
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1210
1211
  return {
1211
1212
  cardId: c.cardID,
1212
1213
  courseId: c.courseID,
1213
- score,
1214
+ score: samplingKey,
1214
1215
  provenance: [
1215
1216
  {
1216
1217
  strategy: "elo",
1217
1218
  strategyName: this.strategyName || this.name,
1218
1219
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1219
1220
  action: "generated",
1220
- score,
1221
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1221
+ score: samplingKey,
1222
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1222
1223
  }
1223
1224
  ]
1224
1225
  };