@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.
@@ -1008,19 +1008,20 @@ var init_elo = __esm({
1008
1008
  const scored = newCards.map((c, i) => {
1009
1009
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1010
1010
  const distance = Math.abs(cardElo - userGlobalElo);
1011
- const score = Math.max(0, 1 - distance / 500);
1011
+ const rawScore = Math.max(0, 1 - distance / 500);
1012
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1012
1013
  return {
1013
1014
  cardId: c.cardID,
1014
1015
  courseId: c.courseID,
1015
- score,
1016
+ score: samplingKey,
1016
1017
  provenance: [
1017
1018
  {
1018
1019
  strategy: "elo",
1019
1020
  strategyName: this.strategyName || this.name,
1020
1021
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1021
1022
  action: "generated",
1022
- score,
1023
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1023
+ score: samplingKey,
1024
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1024
1025
  }
1025
1026
  ]
1026
1027
  };