@vue-skuilder/db 0.2.4 → 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.
@@ -1764,12 +1764,13 @@ __export(elo_exports, {
1764
1764
  default: () => ELONavigator
1765
1765
  });
1766
1766
  import { toCourseElo as toCourseElo2 } from "@vue-skuilder/common";
1767
- var ELONavigator;
1767
+ var ELO_RELEVANCE_SIGMA, ELONavigator;
1768
1768
  var init_elo = __esm({
1769
1769
  "src/core/navigators/generators/elo.ts"() {
1770
1770
  "use strict";
1771
1771
  init_navigators();
1772
1772
  init_logger();
1773
+ ELO_RELEVANCE_SIGMA = 300;
1773
1774
  ELONavigator = class extends ContentNavigator {
1774
1775
  /** Human-readable name for CardGenerator interface */
1775
1776
  name;
@@ -1809,8 +1810,8 @@ var init_elo = __esm({
1809
1810
  const scored = newCards.map((c) => {
1810
1811
  const cardElo = c.elo ?? 1e3;
1811
1812
  const distance = Math.abs(cardElo - userGlobalElo);
1812
- const rawScore = Math.max(0, 1 - distance / 500);
1813
- const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1813
+ const relevance = Math.exp(-((distance / ELO_RELEVANCE_SIGMA) ** 2));
1814
+ const samplingKey = relevance * (0.5 + 0.5 * Math.random());
1814
1815
  return {
1815
1816
  cardId: c.cardID,
1816
1817
  courseId: c.courseID,
@@ -1822,7 +1823,7 @@ var init_elo = __esm({
1822
1823
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1823
1824
  action: "generated",
1824
1825
  score: samplingKey,
1825
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1826
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), relevance ${relevance.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1826
1827
  }
1827
1828
  ]
1828
1829
  };