@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/impl/couch/index.js
CHANGED
|
@@ -3238,6 +3238,7 @@ __export(eloDistance_exports, {
|
|
|
3238
3238
|
DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
|
|
3239
3239
|
createEloDistanceFilter: () => createEloDistanceFilter,
|
|
3240
3240
|
default: () => EloDistanceFilter,
|
|
3241
|
+
mountMultiDimEloToggle: () => mountMultiDimEloToggle,
|
|
3241
3242
|
tagAwareGap: () => tagAwareGap
|
|
3242
3243
|
});
|
|
3243
3244
|
function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
@@ -3248,6 +3249,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
|
3248
3249
|
function resolveConfig(config) {
|
|
3249
3250
|
return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
|
|
3250
3251
|
}
|
|
3252
|
+
function readMultiDimElo() {
|
|
3253
|
+
try {
|
|
3254
|
+
return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
|
|
3255
|
+
} catch {
|
|
3256
|
+
return false;
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
function mountMultiDimEloToggle() {
|
|
3260
|
+
if (typeof window === "undefined") return;
|
|
3261
|
+
const win = window;
|
|
3262
|
+
win.skuilder = win.skuilder || {};
|
|
3263
|
+
Object.defineProperty(win.skuilder, "multiDimElo", {
|
|
3264
|
+
configurable: true,
|
|
3265
|
+
enumerable: true,
|
|
3266
|
+
get: () => multiDimElo,
|
|
3267
|
+
set: (on) => {
|
|
3268
|
+
multiDimElo = on === true;
|
|
3269
|
+
try {
|
|
3270
|
+
if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
|
|
3271
|
+
else localStorage.removeItem(MULTI_DIM_ELO_KEY);
|
|
3272
|
+
} catch (e) {
|
|
3273
|
+
logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
|
|
3274
|
+
}
|
|
3275
|
+
logger.info(
|
|
3276
|
+
`[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
|
|
3277
|
+
);
|
|
3278
|
+
}
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3251
3281
|
function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
|
|
3252
3282
|
const globalGap = cardElo.global.score - userElo.global.score;
|
|
3253
3283
|
const tags = [];
|
|
@@ -3275,7 +3305,7 @@ function tagReason(tags, globalGap) {
|
|
|
3275
3305
|
async function applyEloDistance(cards, context, config, source) {
|
|
3276
3306
|
const { course, userElo, userCourseElo } = context;
|
|
3277
3307
|
const { halfLife, minMultiplier, maxMultiplier } = config;
|
|
3278
|
-
const tagAware = config.tagAware && userCourseElo !== void 0;
|
|
3308
|
+
const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
|
|
3279
3309
|
const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
|
|
3280
3310
|
const fetched = /* @__PURE__ */ new Map();
|
|
3281
3311
|
if (missing.length > 0) {
|
|
@@ -3289,10 +3319,10 @@ async function applyEloDistance(cards, context, config, source) {
|
|
|
3289
3319
|
const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
|
|
3290
3320
|
let distance = Math.abs(cardElo - userElo);
|
|
3291
3321
|
let how = "";
|
|
3292
|
-
if (tagAware
|
|
3293
|
-
const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
|
|
3294
|
-
distance = Math.abs(t.gap);
|
|
3295
|
-
|
|
3322
|
+
if (tagAware) {
|
|
3323
|
+
const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
|
|
3324
|
+
if (t) distance = Math.abs(t.gap);
|
|
3325
|
+
how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
|
|
3296
3326
|
}
|
|
3297
3327
|
const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
|
|
3298
3328
|
const newScore = card.score * multiplier;
|
|
@@ -3325,21 +3355,25 @@ function createEloDistanceFilter(config) {
|
|
|
3325
3355
|
transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
|
|
3326
3356
|
};
|
|
3327
3357
|
}
|
|
3328
|
-
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
|
|
3358
|
+
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
|
|
3329
3359
|
var init_eloDistance = __esm({
|
|
3330
3360
|
"src/core/navigators/filters/eloDistance.ts"() {
|
|
3331
3361
|
"use strict";
|
|
3332
3362
|
init_navigators();
|
|
3363
|
+
init_logger();
|
|
3333
3364
|
DEFAULT_ELO_DISTANCE_CONFIG = {
|
|
3334
3365
|
halfLife: 300,
|
|
3335
3366
|
minMultiplier: 0.05,
|
|
3336
3367
|
maxMultiplier: 1,
|
|
3337
|
-
tagAware:
|
|
3368
|
+
tagAware: false,
|
|
3338
3369
|
minTagCount: 3
|
|
3339
3370
|
};
|
|
3340
3371
|
TAG_CONFIDENCE_HALF = 10;
|
|
3341
3372
|
COUNT_ONLY_SENTINEL = -1;
|
|
3342
3373
|
DEFAULT_CARD_ELO = 1e3;
|
|
3374
|
+
MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
|
|
3375
|
+
multiDimElo = readMultiDimElo();
|
|
3376
|
+
mountMultiDimEloToggle();
|
|
3343
3377
|
EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
|
|
3344
3378
|
name;
|
|
3345
3379
|
/** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */
|