@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.
@@ -1032,19 +1032,20 @@ var init_elo = __esm({
1032
1032
  const scored = newCards.map((c, i) => {
1033
1033
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1034
1034
  const distance = Math.abs(cardElo - userGlobalElo);
1035
- const score = Math.max(0, 1 - distance / 500);
1035
+ const rawScore = Math.max(0, 1 - distance / 500);
1036
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1036
1037
  return {
1037
1038
  cardId: c.cardID,
1038
1039
  courseId: c.courseID,
1039
- score,
1040
+ score: samplingKey,
1040
1041
  provenance: [
1041
1042
  {
1042
1043
  strategy: "elo",
1043
1044
  strategyName: this.strategyName || this.name,
1044
1045
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1045
1046
  action: "generated",
1046
- score,
1047
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1047
+ score: samplingKey,
1048
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1048
1049
  }
1049
1050
  ]
1050
1051
  };