@vue-skuilder/db 0.2.3 → 0.2.5

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.
@@ -1710,13 +1710,14 @@ var elo_exports = {};
1710
1710
  __export(elo_exports, {
1711
1711
  default: () => ELONavigator
1712
1712
  });
1713
- var import_common5, ELONavigator;
1713
+ var import_common5, ELO_RELEVANCE_SIGMA, ELONavigator;
1714
1714
  var init_elo = __esm({
1715
1715
  "src/core/navigators/generators/elo.ts"() {
1716
1716
  "use strict";
1717
1717
  init_navigators();
1718
1718
  import_common5 = require("@vue-skuilder/common");
1719
1719
  init_logger();
1720
+ ELO_RELEVANCE_SIGMA = 300;
1720
1721
  ELONavigator = class extends ContentNavigator {
1721
1722
  /** Human-readable name for CardGenerator interface */
1722
1723
  name;
@@ -1756,8 +1757,8 @@ var init_elo = __esm({
1756
1757
  const scored = newCards.map((c) => {
1757
1758
  const cardElo = c.elo ?? 1e3;
1758
1759
  const distance = Math.abs(cardElo - userGlobalElo);
1759
- const rawScore = Math.max(0, 1 - distance / 500);
1760
- const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1760
+ const relevance = Math.exp(-((distance / ELO_RELEVANCE_SIGMA) ** 2));
1761
+ const samplingKey = relevance * (0.5 + 0.5 * Math.random());
1761
1762
  return {
1762
1763
  cardId: c.cardID,
1763
1764
  courseId: c.courseID,
@@ -1769,7 +1770,7 @@ var init_elo = __esm({
1769
1770
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1770
1771
  action: "generated",
1771
1772
  score: samplingKey,
1772
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1773
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), relevance ${relevance.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1773
1774
  }
1774
1775
  ]
1775
1776
  };