@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.
@@ -1153,19 +1153,20 @@ var init_elo = __esm({
1153
1153
  const scored = newCards.map((c, i) => {
1154
1154
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1155
1155
  const distance = Math.abs(cardElo - userGlobalElo);
1156
- const score = Math.max(0, 1 - distance / 500);
1156
+ const rawScore = Math.max(0, 1 - distance / 500);
1157
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1157
1158
  return {
1158
1159
  cardId: c.cardID,
1159
1160
  courseId: c.courseID,
1160
- score,
1161
+ score: samplingKey,
1161
1162
  provenance: [
1162
1163
  {
1163
1164
  strategy: "elo",
1164
1165
  strategyName: this.strategyName || this.name,
1165
1166
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1166
1167
  action: "generated",
1167
- score,
1168
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1168
+ score: samplingKey,
1169
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1169
1170
  }
1170
1171
  ]
1171
1172
  };