@vue-skuilder/db 0.2.29 → 0.2.30
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.
- package/dist/core/index.js +41 -7
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +41 -7
- package/dist/core/index.mjs.map +1 -1
- package/dist/impl/couch/index.js +41 -7
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +41 -7
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.js +41 -7
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +41 -7
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.js +41 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/navigators/filters/eloDistance.ts +72 -13
package/dist/index.mjs
CHANGED
|
@@ -3252,6 +3252,7 @@ __export(eloDistance_exports, {
|
|
|
3252
3252
|
DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
|
|
3253
3253
|
createEloDistanceFilter: () => createEloDistanceFilter,
|
|
3254
3254
|
default: () => EloDistanceFilter,
|
|
3255
|
+
mountMultiDimEloToggle: () => mountMultiDimEloToggle,
|
|
3255
3256
|
tagAwareGap: () => tagAwareGap
|
|
3256
3257
|
});
|
|
3257
3258
|
function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
@@ -3262,6 +3263,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
|
3262
3263
|
function resolveConfig(config) {
|
|
3263
3264
|
return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
|
|
3264
3265
|
}
|
|
3266
|
+
function readMultiDimElo() {
|
|
3267
|
+
try {
|
|
3268
|
+
return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
|
|
3269
|
+
} catch {
|
|
3270
|
+
return false;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
function mountMultiDimEloToggle() {
|
|
3274
|
+
if (typeof window === "undefined") return;
|
|
3275
|
+
const win = window;
|
|
3276
|
+
win.skuilder = win.skuilder || {};
|
|
3277
|
+
Object.defineProperty(win.skuilder, "multiDimElo", {
|
|
3278
|
+
configurable: true,
|
|
3279
|
+
enumerable: true,
|
|
3280
|
+
get: () => multiDimElo,
|
|
3281
|
+
set: (on) => {
|
|
3282
|
+
multiDimElo = on === true;
|
|
3283
|
+
try {
|
|
3284
|
+
if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
|
|
3285
|
+
else localStorage.removeItem(MULTI_DIM_ELO_KEY);
|
|
3286
|
+
} catch (e) {
|
|
3287
|
+
logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
|
|
3288
|
+
}
|
|
3289
|
+
logger.info(
|
|
3290
|
+
`[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
|
|
3291
|
+
);
|
|
3292
|
+
}
|
|
3293
|
+
});
|
|
3294
|
+
}
|
|
3265
3295
|
function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
|
|
3266
3296
|
const globalGap = cardElo.global.score - userElo.global.score;
|
|
3267
3297
|
const tags = [];
|
|
@@ -3289,7 +3319,7 @@ function tagReason(tags, globalGap) {
|
|
|
3289
3319
|
async function applyEloDistance(cards, context, config, source) {
|
|
3290
3320
|
const { course, userElo, userCourseElo } = context;
|
|
3291
3321
|
const { halfLife, minMultiplier, maxMultiplier } = config;
|
|
3292
|
-
const tagAware = config.tagAware && userCourseElo !== void 0;
|
|
3322
|
+
const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
|
|
3293
3323
|
const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
|
|
3294
3324
|
const fetched = /* @__PURE__ */ new Map();
|
|
3295
3325
|
if (missing.length > 0) {
|
|
@@ -3303,10 +3333,10 @@ async function applyEloDistance(cards, context, config, source) {
|
|
|
3303
3333
|
const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
|
|
3304
3334
|
let distance = Math.abs(cardElo - userElo);
|
|
3305
3335
|
let how = "";
|
|
3306
|
-
if (tagAware
|
|
3307
|
-
const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
|
|
3308
|
-
distance = Math.abs(t.gap);
|
|
3309
|
-
|
|
3336
|
+
if (tagAware) {
|
|
3337
|
+
const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
|
|
3338
|
+
if (t) distance = Math.abs(t.gap);
|
|
3339
|
+
how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
|
|
3310
3340
|
}
|
|
3311
3341
|
const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
|
|
3312
3342
|
const newScore = card.score * multiplier;
|
|
@@ -3339,21 +3369,25 @@ function createEloDistanceFilter(config) {
|
|
|
3339
3369
|
transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
|
|
3340
3370
|
};
|
|
3341
3371
|
}
|
|
3342
|
-
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
|
|
3372
|
+
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
|
|
3343
3373
|
var init_eloDistance = __esm({
|
|
3344
3374
|
"src/core/navigators/filters/eloDistance.ts"() {
|
|
3345
3375
|
"use strict";
|
|
3346
3376
|
init_navigators();
|
|
3377
|
+
init_logger();
|
|
3347
3378
|
DEFAULT_ELO_DISTANCE_CONFIG = {
|
|
3348
3379
|
halfLife: 300,
|
|
3349
3380
|
minMultiplier: 0.05,
|
|
3350
3381
|
maxMultiplier: 1,
|
|
3351
|
-
tagAware:
|
|
3382
|
+
tagAware: false,
|
|
3352
3383
|
minTagCount: 3
|
|
3353
3384
|
};
|
|
3354
3385
|
TAG_CONFIDENCE_HALF = 10;
|
|
3355
3386
|
COUNT_ONLY_SENTINEL = -1;
|
|
3356
3387
|
DEFAULT_CARD_ELO = 1e3;
|
|
3388
|
+
MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
|
|
3389
|
+
multiDimElo = readMultiDimElo();
|
|
3390
|
+
mountMultiDimEloToggle();
|
|
3357
3391
|
EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
|
|
3358
3392
|
name;
|
|
3359
3393
|
/** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */
|