@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.
@@ -1131,19 +1131,20 @@ var init_elo = __esm({
1131
1131
  const scored = newCards.map((c, i) => {
1132
1132
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1133
1133
  const distance = Math.abs(cardElo - userGlobalElo);
1134
- const score = Math.max(0, 1 - distance / 500);
1134
+ const rawScore = Math.max(0, 1 - distance / 500);
1135
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1135
1136
  return {
1136
1137
  cardId: c.cardID,
1137
1138
  courseId: c.courseID,
1138
- score,
1139
+ score: samplingKey,
1139
1140
  provenance: [
1140
1141
  {
1141
1142
  strategy: "elo",
1142
1143
  strategyName: this.strategyName || this.name,
1143
1144
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1144
1145
  action: "generated",
1145
- score,
1146
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1146
+ score: samplingKey,
1147
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1147
1148
  }
1148
1149
  ]
1149
1150
  };