@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.js
CHANGED
|
@@ -3274,6 +3274,7 @@ __export(eloDistance_exports, {
|
|
|
3274
3274
|
DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
|
|
3275
3275
|
createEloDistanceFilter: () => createEloDistanceFilter,
|
|
3276
3276
|
default: () => EloDistanceFilter,
|
|
3277
|
+
mountMultiDimEloToggle: () => mountMultiDimEloToggle,
|
|
3277
3278
|
tagAwareGap: () => tagAwareGap
|
|
3278
3279
|
});
|
|
3279
3280
|
function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
@@ -3284,6 +3285,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
|
3284
3285
|
function resolveConfig(config) {
|
|
3285
3286
|
return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
|
|
3286
3287
|
}
|
|
3288
|
+
function readMultiDimElo() {
|
|
3289
|
+
try {
|
|
3290
|
+
return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
|
|
3291
|
+
} catch {
|
|
3292
|
+
return false;
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
function mountMultiDimEloToggle() {
|
|
3296
|
+
if (typeof window === "undefined") return;
|
|
3297
|
+
const win = window;
|
|
3298
|
+
win.skuilder = win.skuilder || {};
|
|
3299
|
+
Object.defineProperty(win.skuilder, "multiDimElo", {
|
|
3300
|
+
configurable: true,
|
|
3301
|
+
enumerable: true,
|
|
3302
|
+
get: () => multiDimElo,
|
|
3303
|
+
set: (on) => {
|
|
3304
|
+
multiDimElo = on === true;
|
|
3305
|
+
try {
|
|
3306
|
+
if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
|
|
3307
|
+
else localStorage.removeItem(MULTI_DIM_ELO_KEY);
|
|
3308
|
+
} catch (e) {
|
|
3309
|
+
logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
|
|
3310
|
+
}
|
|
3311
|
+
logger.info(
|
|
3312
|
+
`[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
|
|
3313
|
+
);
|
|
3314
|
+
}
|
|
3315
|
+
});
|
|
3316
|
+
}
|
|
3287
3317
|
function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
|
|
3288
3318
|
const globalGap = cardElo.global.score - userElo.global.score;
|
|
3289
3319
|
const tags = [];
|
|
@@ -3311,7 +3341,7 @@ function tagReason(tags, globalGap) {
|
|
|
3311
3341
|
async function applyEloDistance(cards, context, config, source) {
|
|
3312
3342
|
const { course, userElo, userCourseElo } = context;
|
|
3313
3343
|
const { halfLife, minMultiplier, maxMultiplier } = config;
|
|
3314
|
-
const tagAware = config.tagAware && userCourseElo !== void 0;
|
|
3344
|
+
const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
|
|
3315
3345
|
const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
|
|
3316
3346
|
const fetched = /* @__PURE__ */ new Map();
|
|
3317
3347
|
if (missing.length > 0) {
|
|
@@ -3325,10 +3355,10 @@ async function applyEloDistance(cards, context, config, source) {
|
|
|
3325
3355
|
const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
|
|
3326
3356
|
let distance = Math.abs(cardElo - userElo);
|
|
3327
3357
|
let how = "";
|
|
3328
|
-
if (tagAware
|
|
3329
|
-
const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
|
|
3330
|
-
distance = Math.abs(t.gap);
|
|
3331
|
-
|
|
3358
|
+
if (tagAware) {
|
|
3359
|
+
const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
|
|
3360
|
+
if (t) distance = Math.abs(t.gap);
|
|
3361
|
+
how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
|
|
3332
3362
|
}
|
|
3333
3363
|
const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
|
|
3334
3364
|
const newScore = card.score * multiplier;
|
|
@@ -3361,21 +3391,25 @@ function createEloDistanceFilter(config) {
|
|
|
3361
3391
|
transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
|
|
3362
3392
|
};
|
|
3363
3393
|
}
|
|
3364
|
-
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
|
|
3394
|
+
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
|
|
3365
3395
|
var init_eloDistance = __esm({
|
|
3366
3396
|
"src/core/navigators/filters/eloDistance.ts"() {
|
|
3367
3397
|
"use strict";
|
|
3368
3398
|
init_navigators();
|
|
3399
|
+
init_logger();
|
|
3369
3400
|
DEFAULT_ELO_DISTANCE_CONFIG = {
|
|
3370
3401
|
halfLife: 300,
|
|
3371
3402
|
minMultiplier: 0.05,
|
|
3372
3403
|
maxMultiplier: 1,
|
|
3373
|
-
tagAware:
|
|
3404
|
+
tagAware: false,
|
|
3374
3405
|
minTagCount: 3
|
|
3375
3406
|
};
|
|
3376
3407
|
TAG_CONFIDENCE_HALF = 10;
|
|
3377
3408
|
COUNT_ONLY_SENTINEL = -1;
|
|
3378
3409
|
DEFAULT_CARD_ELO = 1e3;
|
|
3410
|
+
MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
|
|
3411
|
+
multiDimElo = readMultiDimElo();
|
|
3412
|
+
mountMultiDimEloToggle();
|
|
3379
3413
|
EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
|
|
3380
3414
|
name;
|
|
3381
3415
|
/** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */
|