@vue-skuilder/db 0.3.2 → 0.3.4
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/{contentSource-CSI0pJ2D.d.ts → contentSource-CPM872yn.d.ts} +2 -1
- package/dist/core/index.cjs +163 -49
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/navigators/filters/eloDistance.mjs.map +1 -1
- package/dist/core/navigators/filters/skillPressure.mjs +109 -0
- package/dist/core/navigators/filters/skillPressure.mjs.map +1 -0
- package/dist/core/navigators/generators/prescribed.mjs.map +1 -1
- package/dist/core/navigators/index.mjs +7 -3
- package/dist/core/navigators/index.mjs.map +1 -1
- package/dist/core/versionStamps.mjs +1 -1
- package/dist/{dataLayerProvider-D5n1gGc_.d.ts → dataLayerProvider-CaNgzRCz.d.ts} +1 -1
- package/dist/diagnostics/derive.mjs.map +1 -1
- package/dist/diagnostics/index.cjs +16 -3
- package/dist/diagnostics/index.cjs.map +1 -1
- package/dist/diagnostics/index.d.ts +29 -6
- package/dist/diagnostics/tagElo.mjs +20 -4
- package/dist/diagnostics/tagElo.mjs.map +1 -1
- package/dist/impl/couch/index.cjs +2 -1
- package/dist/impl/couch/index.cjs.map +1 -1
- package/dist/impl/couch/index.d.ts +2 -2
- package/dist/impl/static/index.cjs +2 -1
- package/dist/impl/static/index.cjs.map +1 -1
- package/dist/impl/static/index.d.ts +2 -2
- package/dist/index.cjs +211 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/study/services/tagRecent.mjs +2 -1
- package/dist/study/services/tagRecent.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/navigators/filters/eloDistance.ts +2 -2
- package/src/core/navigators/filters/index.ts +3 -0
- package/src/core/navigators/filters/skillPressure.ts +194 -0
- package/src/core/navigators/generators/prescribed.ts +5 -6
- package/src/core/navigators/index.ts +5 -0
- package/src/diagnostics/derive.ts +6 -1
- package/src/diagnostics/tagElo.ts +43 -3
- package/src/study/services/tagRecent.test.ts +57 -3
- package/src/study/services/tagRecent.ts +8 -1
- package/tests/core/navigators/skillPressureFilter.test.ts +84 -0
package/dist/index.cjs
CHANGED
|
@@ -3340,6 +3340,115 @@ var init_eloDistance = __esm({
|
|
|
3340
3340
|
}
|
|
3341
3341
|
});
|
|
3342
3342
|
|
|
3343
|
+
// src/core/navigators/filters/skillPressure.ts
|
|
3344
|
+
var skillPressure_exports = {};
|
|
3345
|
+
__export(skillPressure_exports, {
|
|
3346
|
+
default: () => SkillPressureFilter,
|
|
3347
|
+
skillPressures: () => skillPressures
|
|
3348
|
+
});
|
|
3349
|
+
function skillPressures(elo, config = {}) {
|
|
3350
|
+
const out = /* @__PURE__ */ new Map();
|
|
3351
|
+
const raise = (tag, pressure, why) => {
|
|
3352
|
+
if (pressure <= 0) return;
|
|
3353
|
+
const prev = out.get(tag);
|
|
3354
|
+
if (!prev || pressure > prev.pressure) out.set(tag, { pressure, why });
|
|
3355
|
+
};
|
|
3356
|
+
for (const s of (0, import_common6.skillNeed)(elo, config).skills) {
|
|
3357
|
+
raise(s.tag, s.need, `need ${s.need.toFixed(2)} (${Math.round(s.deficit)} below the skill median)`);
|
|
3358
|
+
}
|
|
3359
|
+
if (config.security !== false) {
|
|
3360
|
+
const weights = { ...DEFAULT_SECURITY_WEIGHTS, ...config.security ?? {} };
|
|
3361
|
+
const { include, exclude, roles } = config;
|
|
3362
|
+
const security = (0, import_common6.courseSecurity)(elo, {
|
|
3363
|
+
selector: { include, exclude, roles },
|
|
3364
|
+
config: config.security ? config.security.config : void 0
|
|
3365
|
+
});
|
|
3366
|
+
for (const s of security.tags) {
|
|
3367
|
+
if (s.status === "secure") continue;
|
|
3368
|
+
const n = Math.min(s.attempts, 12);
|
|
3369
|
+
raise(
|
|
3370
|
+
s.tag,
|
|
3371
|
+
weights[s.status],
|
|
3372
|
+
s.status === "shaky" ? `shaky (${s.right}/${n} right)` : `unproven (${s.attempts} recent attempts)`
|
|
3373
|
+
);
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
return out;
|
|
3377
|
+
}
|
|
3378
|
+
async function applySkillPressure(cards, context, config, source) {
|
|
3379
|
+
if (!context.userCourseElo) return cards;
|
|
3380
|
+
const pressures = skillPressures(context.userCourseElo, config);
|
|
3381
|
+
if (pressures.size === 0) return cards;
|
|
3382
|
+
const gain = config.gain ?? DEFAULT_GAIN;
|
|
3383
|
+
return cards.map((card) => {
|
|
3384
|
+
let top = null;
|
|
3385
|
+
for (const tag of card.tags ?? []) {
|
|
3386
|
+
const entry = pressures.get(tag);
|
|
3387
|
+
if (entry && (!top || entry.pressure > top.entry.pressure)) top = { tag, entry };
|
|
3388
|
+
}
|
|
3389
|
+
if (!top) return card;
|
|
3390
|
+
const multiplier = 1 + gain * top.entry.pressure;
|
|
3391
|
+
const score = card.score * multiplier;
|
|
3392
|
+
return {
|
|
3393
|
+
...card,
|
|
3394
|
+
score,
|
|
3395
|
+
provenance: [
|
|
3396
|
+
...card.provenance,
|
|
3397
|
+
{
|
|
3398
|
+
strategy: "skillPressure",
|
|
3399
|
+
strategyName: source.name,
|
|
3400
|
+
strategyId: source.strategyId,
|
|
3401
|
+
action: "boosted",
|
|
3402
|
+
score,
|
|
3403
|
+
reason: `skill pressure: ${top.tag} ${top.entry.why} \u2192 \xD7${multiplier.toFixed(2)}`
|
|
3404
|
+
}
|
|
3405
|
+
]
|
|
3406
|
+
};
|
|
3407
|
+
});
|
|
3408
|
+
}
|
|
3409
|
+
var import_common6, DEFAULT_GAIN, DEFAULT_SECURITY_WEIGHTS, SkillPressureFilter;
|
|
3410
|
+
var init_skillPressure = __esm({
|
|
3411
|
+
"src/core/navigators/filters/skillPressure.ts"() {
|
|
3412
|
+
"use strict";
|
|
3413
|
+
import_common6 = require("@vue-skuilder/common");
|
|
3414
|
+
init_navigators();
|
|
3415
|
+
DEFAULT_GAIN = 0.5;
|
|
3416
|
+
DEFAULT_SECURITY_WEIGHTS = {
|
|
3417
|
+
shaky: 0.8,
|
|
3418
|
+
unproven: 0.5
|
|
3419
|
+
};
|
|
3420
|
+
SkillPressureFilter = class _SkillPressureFilter extends ContentNavigator {
|
|
3421
|
+
name;
|
|
3422
|
+
/** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */
|
|
3423
|
+
static kind = "signal";
|
|
3424
|
+
kind = _SkillPressureFilter.kind;
|
|
3425
|
+
config;
|
|
3426
|
+
constructor(user, course, strategyData) {
|
|
3427
|
+
super(user, course, strategyData);
|
|
3428
|
+
this.name = strategyData.name || "Skill Pressure";
|
|
3429
|
+
let parsed = {};
|
|
3430
|
+
try {
|
|
3431
|
+
parsed = strategyData.serializedData ? JSON.parse(strategyData.serializedData) : {};
|
|
3432
|
+
} catch {
|
|
3433
|
+
parsed = {};
|
|
3434
|
+
}
|
|
3435
|
+
this.config = parsed;
|
|
3436
|
+
}
|
|
3437
|
+
transform(cards, context) {
|
|
3438
|
+
return applySkillPressure(cards, context, this.config, {
|
|
3439
|
+
name: this.name,
|
|
3440
|
+
strategyId: this.strategyId || "NAVIGATION_STRATEGY-skillPressure"
|
|
3441
|
+
});
|
|
3442
|
+
}
|
|
3443
|
+
async getWeightedCards(_limit) {
|
|
3444
|
+
throw new Error(
|
|
3445
|
+
"SkillPressureFilter is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform()."
|
|
3446
|
+
);
|
|
3447
|
+
}
|
|
3448
|
+
};
|
|
3449
|
+
}
|
|
3450
|
+
});
|
|
3451
|
+
|
|
3343
3452
|
// src/core/navigators/index.ts
|
|
3344
3453
|
function registerNavigator(implementingClass, constructor, role) {
|
|
3345
3454
|
navigatorRegistry.set(implementingClass, { constructor, role });
|
|
@@ -3376,19 +3485,22 @@ async function initializeNavigatorRegistry() {
|
|
|
3376
3485
|
interferenceModule,
|
|
3377
3486
|
relativePriorityModule,
|
|
3378
3487
|
userTagPreferenceModule,
|
|
3379
|
-
eloDistanceModule
|
|
3488
|
+
eloDistanceModule,
|
|
3489
|
+
skillPressureModule
|
|
3380
3490
|
] = await Promise.all([
|
|
3381
3491
|
Promise.resolve().then(() => (init_hierarchyDefinition(), hierarchyDefinition_exports)),
|
|
3382
3492
|
Promise.resolve().then(() => (init_interferenceMitigator(), interferenceMitigator_exports)),
|
|
3383
3493
|
Promise.resolve().then(() => (init_relativePriority(), relativePriority_exports)),
|
|
3384
3494
|
Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports)),
|
|
3385
|
-
Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports))
|
|
3495
|
+
Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports)),
|
|
3496
|
+
Promise.resolve().then(() => (init_skillPressure(), skillPressure_exports))
|
|
3386
3497
|
]);
|
|
3387
3498
|
registerNavigator("hierarchyDefinition", hierarchyModule.default);
|
|
3388
3499
|
registerNavigator("interferenceMitigator", interferenceModule.default);
|
|
3389
3500
|
registerNavigator("relativePriority", relativePriorityModule.default);
|
|
3390
3501
|
registerNavigator("userTagPreference", userTagPreferenceModule.default);
|
|
3391
3502
|
registerNavigator("eloDistance", eloDistanceModule.default);
|
|
3503
|
+
registerNavigator("skillPressure", skillPressureModule.default);
|
|
3392
3504
|
logger.debug(
|
|
3393
3505
|
`[NavigatorRegistry] Initialized ${navigatorRegistry.size} navigators: ${getRegisteredNavigatorNames().join(", ")}`
|
|
3394
3506
|
);
|
|
@@ -3434,6 +3546,7 @@ var init_navigators = __esm({
|
|
|
3434
3546
|
Navigators2["RELATIVE_PRIORITY"] = "relativePriority";
|
|
3435
3547
|
Navigators2["USER_TAG_PREFERENCE"] = "userTagPreference";
|
|
3436
3548
|
Navigators2["ELO_DISTANCE"] = "eloDistance";
|
|
3549
|
+
Navigators2["SKILL_PRESSURE"] = "skillPressure";
|
|
3437
3550
|
return Navigators2;
|
|
3438
3551
|
})(Navigators || {});
|
|
3439
3552
|
NavigatorRole = /* @__PURE__ */ ((NavigatorRole2) => {
|
|
@@ -3449,7 +3562,8 @@ var init_navigators = __esm({
|
|
|
3449
3562
|
["interferenceMitigator" /* INTERFERENCE */]: "filter" /* FILTER */,
|
|
3450
3563
|
["relativePriority" /* RELATIVE_PRIORITY */]: "filter" /* FILTER */,
|
|
3451
3564
|
["userTagPreference" /* USER_TAG_PREFERENCE */]: "filter" /* FILTER */,
|
|
3452
|
-
["eloDistance" /* ELO_DISTANCE */]: "filter" /* FILTER
|
|
3565
|
+
["eloDistance" /* ELO_DISTANCE */]: "filter" /* FILTER */,
|
|
3566
|
+
["skillPressure" /* SKILL_PRESSURE */]: "filter" /* FILTER */
|
|
3453
3567
|
};
|
|
3454
3568
|
ContentNavigator = class {
|
|
3455
3569
|
/** User interface for this navigation session */
|
|
@@ -3659,7 +3773,7 @@ var FRAMEWORK_VERSION, hostAppVersion, DEFAULT_STRATEGY_HASH;
|
|
|
3659
3773
|
var init_versionStamps = __esm({
|
|
3660
3774
|
"src/core/versionStamps.ts"() {
|
|
3661
3775
|
"use strict";
|
|
3662
|
-
FRAMEWORK_VERSION = true ? "0.3.
|
|
3776
|
+
FRAMEWORK_VERSION = true ? "0.3.4" : "dev";
|
|
3663
3777
|
DEFAULT_STRATEGY_HASH = "default";
|
|
3664
3778
|
}
|
|
3665
3779
|
});
|
|
@@ -3994,7 +4108,7 @@ function newQuestionInterval(user, cardHistory) {
|
|
|
3994
4108
|
}
|
|
3995
4109
|
if (currentAttempt.isCorrect) {
|
|
3996
4110
|
const rawPerf = currentAttempt.performance;
|
|
3997
|
-
const numericPerf = (0,
|
|
4111
|
+
const numericPerf = (0, import_common7.isTaggedPerformance)(rawPerf) ? rawPerf._global : rawPerf;
|
|
3998
4112
|
const skill = Math.min(1, Math.max(0, numericPerf));
|
|
3999
4113
|
logger.debug(`Demontrated skill: ${skill}`);
|
|
4000
4114
|
const interval = lastInterval * (0.75 + skill);
|
|
@@ -4050,13 +4164,13 @@ function secondsBetween(start, end) {
|
|
|
4050
4164
|
const ret = duration(end.diff(start)).asSeconds();
|
|
4051
4165
|
return ret;
|
|
4052
4166
|
}
|
|
4053
|
-
var import_moment3,
|
|
4167
|
+
var import_moment3, import_common7, duration, SLOW_CORRECT_MAX_INTERVAL;
|
|
4054
4168
|
var init_SpacedRepetition = __esm({
|
|
4055
4169
|
"src/study/SpacedRepetition.ts"() {
|
|
4056
4170
|
"use strict";
|
|
4057
4171
|
init_util();
|
|
4058
4172
|
import_moment3 = __toESM(require("moment"), 1);
|
|
4059
|
-
|
|
4173
|
+
import_common7 = require("@vue-skuilder/common");
|
|
4060
4174
|
init_logger();
|
|
4061
4175
|
duration = import_moment3.default.duration;
|
|
4062
4176
|
SLOW_CORRECT_MAX_INTERVAL = 20 * 60 * 60;
|
|
@@ -4131,17 +4245,23 @@ function recordTagPresentations(userElo, perf, records, cardId, at) {
|
|
|
4131
4245
|
if (tag === "_global") continue;
|
|
4132
4246
|
if (typeof score !== "number") continue;
|
|
4133
4247
|
const rank = userElo.tags[tag] ?? { score: userElo.global.score, count: 0 };
|
|
4134
|
-
const entry = {
|
|
4135
|
-
|
|
4248
|
+
const entry = {
|
|
4249
|
+
at,
|
|
4250
|
+
ok,
|
|
4251
|
+
tagOk: score > import_common8.TAG_OK_MIN_PERF,
|
|
4252
|
+
perf: score,
|
|
4253
|
+
card: cardId
|
|
4254
|
+
};
|
|
4255
|
+
userElo.tags[tag] = (0, import_common8.pushTagPresentation)(rank, entry);
|
|
4136
4256
|
written.push(tag);
|
|
4137
4257
|
}
|
|
4138
4258
|
return written;
|
|
4139
4259
|
}
|
|
4140
|
-
var
|
|
4260
|
+
var import_common8;
|
|
4141
4261
|
var init_tagRecent = __esm({
|
|
4142
4262
|
"src/study/services/tagRecent.ts"() {
|
|
4143
4263
|
"use strict";
|
|
4144
|
-
|
|
4264
|
+
import_common8 = require("@vue-skuilder/common");
|
|
4145
4265
|
}
|
|
4146
4266
|
});
|
|
4147
4267
|
|
|
@@ -4150,7 +4270,7 @@ function withCountOnlyRoles(perf, cardId) {
|
|
|
4150
4270
|
const out = { ...perf };
|
|
4151
4271
|
const counted = [];
|
|
4152
4272
|
for (const [tag, score] of Object.entries(perf)) {
|
|
4153
|
-
if (tag === "_global" || score === null || !(0,
|
|
4273
|
+
if (tag === "_global" || score === null || !(0, import_common9.isCountOnlyTag)(tag)) continue;
|
|
4154
4274
|
out[tag] = null;
|
|
4155
4275
|
counted.push(tag);
|
|
4156
4276
|
}
|
|
@@ -4161,11 +4281,11 @@ function withCountOnlyRoles(perf, cardId) {
|
|
|
4161
4281
|
}
|
|
4162
4282
|
return out;
|
|
4163
4283
|
}
|
|
4164
|
-
var
|
|
4284
|
+
var import_common9, EloService;
|
|
4165
4285
|
var init_EloService = __esm({
|
|
4166
4286
|
"src/study/services/EloService.ts"() {
|
|
4167
4287
|
"use strict";
|
|
4168
|
-
|
|
4288
|
+
import_common9 = require("@vue-skuilder/common");
|
|
4169
4289
|
init_logger();
|
|
4170
4290
|
init_tagRecent();
|
|
4171
4291
|
EloService = class {
|
|
@@ -4218,7 +4338,7 @@ var init_EloService = __esm({
|
|
|
4218
4338
|
);
|
|
4219
4339
|
return null;
|
|
4220
4340
|
}
|
|
4221
|
-
const userElo = (0,
|
|
4341
|
+
const userElo = (0, import_common9.toCourseElo)(courseReg.elo);
|
|
4222
4342
|
const cardElo = (await courseDB.getCardEloData([currentCard.card.card_id]))[0];
|
|
4223
4343
|
if (cardElo && userElo) {
|
|
4224
4344
|
const writeCard = !await this.isQaUser(courseDB);
|
|
@@ -4229,11 +4349,11 @@ var init_EloService = __esm({
|
|
|
4229
4349
|
for (const tag of cardTagKeys) {
|
|
4230
4350
|
beforeUserTag[tag] = userElo.tags[tag]?.score ?? userElo.global.score;
|
|
4231
4351
|
}
|
|
4232
|
-
const eloUpdate = (0,
|
|
4352
|
+
const eloUpdate = (0, import_common9.adjustCourseScores)(userElo, cardElo, userScore);
|
|
4233
4353
|
courseReg.elo = eloUpdate.userElo;
|
|
4234
4354
|
const tags = {};
|
|
4235
4355
|
for (const tag of cardTagKeys) {
|
|
4236
|
-
const countOnly = (0,
|
|
4356
|
+
const countOnly = (0, import_common9.isCountOnlyTag)(tag);
|
|
4237
4357
|
tags[tag] = {
|
|
4238
4358
|
before: beforeUserTag[tag],
|
|
4239
4359
|
after: countOnly ? beforeUserTag[tag] : eloUpdate.userElo.tags[tag].score,
|
|
@@ -4307,7 +4427,7 @@ var init_EloService = __esm({
|
|
|
4307
4427
|
);
|
|
4308
4428
|
return null;
|
|
4309
4429
|
}
|
|
4310
|
-
const userElo = (0,
|
|
4430
|
+
const userElo = (0, import_common9.toCourseElo)(courseReg.elo);
|
|
4311
4431
|
const [cardEloResults, cardTagsMap] = await Promise.all([
|
|
4312
4432
|
courseDB.getCardEloData([currentCard.card.card_id]),
|
|
4313
4433
|
courseDB.getAppliedTagsBatch([card_id])
|
|
@@ -4319,7 +4439,7 @@ var init_EloService = __esm({
|
|
|
4319
4439
|
const globalScore = taggedPerformance._global;
|
|
4320
4440
|
for (const tag of cardTags) {
|
|
4321
4441
|
if (!(tag in enriched)) {
|
|
4322
|
-
enriched[tag] = (0,
|
|
4442
|
+
enriched[tag] = (0, import_common9.isCountOnlyTag)(tag) ? null : globalScore;
|
|
4323
4443
|
}
|
|
4324
4444
|
}
|
|
4325
4445
|
if (cardElo && userElo) {
|
|
@@ -4331,7 +4451,7 @@ var init_EloService = __esm({
|
|
|
4331
4451
|
for (const tag of touchedTags) {
|
|
4332
4452
|
beforeUserTag[tag] = userElo.tags[tag]?.score ?? userElo.global.score;
|
|
4333
4453
|
}
|
|
4334
|
-
const eloUpdate = (0,
|
|
4454
|
+
const eloUpdate = (0, import_common9.adjustCourseScoresPerTag)(userElo, cardElo, enriched);
|
|
4335
4455
|
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
4336
4456
|
const recorded = recordTagPresentations(
|
|
4337
4457
|
eloUpdate.userElo,
|
|
@@ -4404,13 +4524,13 @@ var init_EloService = __esm({
|
|
|
4404
4524
|
});
|
|
4405
4525
|
|
|
4406
4526
|
// src/study/services/ResponseProcessor.ts
|
|
4407
|
-
var
|
|
4527
|
+
var import_common10, ResponseProcessor;
|
|
4408
4528
|
var init_ResponseProcessor = __esm({
|
|
4409
4529
|
"src/study/services/ResponseProcessor.ts"() {
|
|
4410
4530
|
"use strict";
|
|
4411
4531
|
init_core();
|
|
4412
4532
|
init_logger();
|
|
4413
|
-
|
|
4533
|
+
import_common10 = require("@vue-skuilder/common");
|
|
4414
4534
|
ResponseProcessor = class {
|
|
4415
4535
|
srsService;
|
|
4416
4536
|
eloService;
|
|
@@ -4453,7 +4573,7 @@ var init_ResponseProcessor = __esm({
|
|
|
4453
4573
|
taggedPerformance: null
|
|
4454
4574
|
};
|
|
4455
4575
|
}
|
|
4456
|
-
if ((0,
|
|
4576
|
+
if ((0, import_common10.isTaggedPerformance)(performance2)) {
|
|
4457
4577
|
return {
|
|
4458
4578
|
globalScore: performance2._global,
|
|
4459
4579
|
taggedPerformance: performance2
|
|
@@ -4756,11 +4876,11 @@ function prefetchAudio(url) {
|
|
|
4756
4876
|
audio.src = url;
|
|
4757
4877
|
});
|
|
4758
4878
|
}
|
|
4759
|
-
var
|
|
4879
|
+
var import_common11, CardHydrationService;
|
|
4760
4880
|
var init_CardHydrationService = __esm({
|
|
4761
4881
|
"src/study/services/CardHydrationService.ts"() {
|
|
4762
4882
|
"use strict";
|
|
4763
|
-
|
|
4883
|
+
import_common11 = require("@vue-skuilder/common");
|
|
4764
4884
|
init_logger();
|
|
4765
4885
|
CardHydrationService = class {
|
|
4766
4886
|
constructor(getViewComponent, getCourseDB2, getItemsToHydrate) {
|
|
@@ -4873,8 +4993,8 @@ var init_CardHydrationService = __esm({
|
|
|
4873
4993
|
courseDB.getCourseDoc(item.cardID),
|
|
4874
4994
|
courseDB.getAppliedTagsBatch([item.cardID])
|
|
4875
4995
|
]);
|
|
4876
|
-
if (!(0,
|
|
4877
|
-
cardData.elo = (0,
|
|
4996
|
+
if (!(0, import_common11.isCourseElo)(cardData.elo)) {
|
|
4997
|
+
cardData.elo = (0, import_common11.toCourseElo)(cardData.elo);
|
|
4878
4998
|
}
|
|
4879
4999
|
const view = this.getViewComponent(cardData.id_view);
|
|
4880
5000
|
const dataDocs = await Promise.all(
|
|
@@ -4898,9 +5018,9 @@ var init_CardHydrationService = __esm({
|
|
|
4898
5018
|
);
|
|
4899
5019
|
await Promise.allSettled(uniqueAudioUrls.map(prefetchAudio));
|
|
4900
5020
|
}
|
|
4901
|
-
const data = dataDocs.map(
|
|
5021
|
+
const data = dataDocs.map(import_common11.displayableDataToViewData).reverse();
|
|
4902
5022
|
this.hydratedCards.set(item.cardID, {
|
|
4903
|
-
item: { ...item, elo: (0,
|
|
5023
|
+
item: { ...item, elo: (0, import_common11.toCourseElo)(cardData.elo).global.score },
|
|
4904
5024
|
view,
|
|
4905
5025
|
data,
|
|
4906
5026
|
tags: tagsByCard.get(item.cardID) ?? []
|
|
@@ -7061,11 +7181,11 @@ function logCardProvenance(cards, maxCards = 3) {
|
|
|
7061
7181
|
}
|
|
7062
7182
|
}
|
|
7063
7183
|
}
|
|
7064
|
-
var
|
|
7184
|
+
var import_common12, VERBOSE_RESULTS, Pipeline;
|
|
7065
7185
|
var init_Pipeline = __esm({
|
|
7066
7186
|
"src/core/navigators/Pipeline.ts"() {
|
|
7067
7187
|
"use strict";
|
|
7068
|
-
|
|
7188
|
+
import_common12 = require("@vue-skuilder/common");
|
|
7069
7189
|
init_navigators();
|
|
7070
7190
|
init_logger();
|
|
7071
7191
|
init_perfMarks();
|
|
@@ -7577,7 +7697,7 @@ var init_Pipeline = __esm({
|
|
|
7577
7697
|
let userCourseElo;
|
|
7578
7698
|
try {
|
|
7579
7699
|
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
7580
|
-
userCourseElo = (0,
|
|
7700
|
+
userCourseElo = (0, import_common12.toCourseElo)(courseReg.elo);
|
|
7581
7701
|
userElo = userCourseElo.global.score;
|
|
7582
7702
|
} catch (e) {
|
|
7583
7703
|
logger.debug(`[Pipeline] Could not get user ELO, using default: ${e}`);
|
|
@@ -7640,7 +7760,7 @@ var init_Pipeline = __esm({
|
|
|
7640
7760
|
*/
|
|
7641
7761
|
async getTagEloStatus(tagFilter) {
|
|
7642
7762
|
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
7643
|
-
const courseElo = (0,
|
|
7763
|
+
const courseElo = (0, import_common12.toCourseElo)(courseReg.elo);
|
|
7644
7764
|
const result = {};
|
|
7645
7765
|
if (!tagFilter) {
|
|
7646
7766
|
for (const [tag, data] of Object.entries(courseElo.tags)) {
|
|
@@ -10226,11 +10346,11 @@ var init_SessionController = __esm({
|
|
|
10226
10346
|
});
|
|
10227
10347
|
|
|
10228
10348
|
// src/study/TagFilteredContentSource.ts
|
|
10229
|
-
var
|
|
10349
|
+
var import_common13, TagFilteredContentSource;
|
|
10230
10350
|
var init_TagFilteredContentSource = __esm({
|
|
10231
10351
|
"src/study/TagFilteredContentSource.ts"() {
|
|
10232
10352
|
"use strict";
|
|
10233
|
-
|
|
10353
|
+
import_common13 = require("@vue-skuilder/common");
|
|
10234
10354
|
init_courseDB();
|
|
10235
10355
|
init_logger();
|
|
10236
10356
|
TagFilteredContentSource = class {
|
|
@@ -10316,7 +10436,7 @@ var init_TagFilteredContentSource = __esm({
|
|
|
10316
10436
|
* @returns Cards sorted by score descending (all scores = 1.0)
|
|
10317
10437
|
*/
|
|
10318
10438
|
async getWeightedCards(limit) {
|
|
10319
|
-
if (!(0,
|
|
10439
|
+
if (!(0, import_common13.hasActiveFilter)(this.filter)) {
|
|
10320
10440
|
logger.warn("[TagFilteredContentSource] getWeightedCards called with no active filter");
|
|
10321
10441
|
return { cards: [] };
|
|
10322
10442
|
}
|
|
@@ -10733,13 +10853,13 @@ async function dropUserFromClassroom(user, classID) {
|
|
|
10733
10853
|
async function getUserClassrooms(user) {
|
|
10734
10854
|
return getOrCreateClassroomRegistrationsDoc(user);
|
|
10735
10855
|
}
|
|
10736
|
-
var
|
|
10856
|
+
var import_common14, import_moment7, log3, HYDRATION_TIMEOUT_MS, BaseUser, userCoursesDoc, userClassroomsDoc;
|
|
10737
10857
|
var init_BaseUserDB = __esm({
|
|
10738
10858
|
"src/impl/common/BaseUserDB.ts"() {
|
|
10739
10859
|
"use strict";
|
|
10740
10860
|
init_core();
|
|
10741
10861
|
init_util();
|
|
10742
|
-
|
|
10862
|
+
import_common14 = require("@vue-skuilder/common");
|
|
10743
10863
|
import_moment7 = __toESM(require("moment"), 1);
|
|
10744
10864
|
init_types_legacy();
|
|
10745
10865
|
init_logger();
|
|
@@ -10846,7 +10966,7 @@ Currently logged-in as ${this._username}.`
|
|
|
10846
10966
|
);
|
|
10847
10967
|
}
|
|
10848
10968
|
const result = await this.syncStrategy.createAccount(username, password);
|
|
10849
|
-
if (result.status ===
|
|
10969
|
+
if (result.status === import_common14.Status.ok) {
|
|
10850
10970
|
log3(`Account created successfully, updating username to ${username}`);
|
|
10851
10971
|
this._username = username;
|
|
10852
10972
|
try {
|
|
@@ -10922,7 +11042,7 @@ Currently logged-in as ${this._username}.`
|
|
|
10922
11042
|
async resetUserData() {
|
|
10923
11043
|
if (this.syncStrategy.canAuthenticate()) {
|
|
10924
11044
|
return {
|
|
10925
|
-
status:
|
|
11045
|
+
status: import_common14.Status.error,
|
|
10926
11046
|
error: "Reset user data is only available for local-only mode. Use logout instead for remote sync."
|
|
10927
11047
|
};
|
|
10928
11048
|
}
|
|
@@ -10944,11 +11064,11 @@ Currently logged-in as ${this._username}.`
|
|
|
10944
11064
|
await localDB.bulkDocs(docsToDelete);
|
|
10945
11065
|
}
|
|
10946
11066
|
await this.init();
|
|
10947
|
-
return { status:
|
|
11067
|
+
return { status: import_common14.Status.ok };
|
|
10948
11068
|
} catch (error) {
|
|
10949
11069
|
logger.error("Failed to reset user data:", error);
|
|
10950
11070
|
return {
|
|
10951
|
-
status:
|
|
11071
|
+
status: import_common14.Status.error,
|
|
10952
11072
|
error: error instanceof Error ? error.message : "Unknown error during reset"
|
|
10953
11073
|
};
|
|
10954
11074
|
}
|
|
@@ -11888,12 +12008,12 @@ var init_common = __esm({
|
|
|
11888
12008
|
});
|
|
11889
12009
|
|
|
11890
12010
|
// src/impl/couch/courseAPI.ts
|
|
11891
|
-
async function addNote55(courseID, codeCourse, shape, data, author, tags, uploads, elo = (0,
|
|
12011
|
+
async function addNote55(courseID, codeCourse, shape, data, author, tags, uploads, elo = (0, import_common16.blankCourseElo)()) {
|
|
11892
12012
|
const db = getCourseDB(courseID);
|
|
11893
|
-
const payload = (0,
|
|
12013
|
+
const payload = (0, import_common17.prepareNote55)(courseID, codeCourse, shape, data, author, tags, uploads);
|
|
11894
12014
|
const _id = `${DocTypePrefixes["DISPLAYABLE_DATA" /* DISPLAYABLE_DATA */]}-${(0, import_uuid.v4)()}`;
|
|
11895
12015
|
const result = await db.put({ ...payload, _id });
|
|
11896
|
-
const dataShapeId =
|
|
12016
|
+
const dataShapeId = import_common15.NameSpacer.getDataShapeString({
|
|
11897
12017
|
course: codeCourse,
|
|
11898
12018
|
dataShape: shape.name
|
|
11899
12019
|
});
|
|
@@ -11920,9 +12040,9 @@ async function addNote55(courseID, codeCourse, shape, data, author, tags, upload
|
|
|
11920
12040
|
}
|
|
11921
12041
|
return result;
|
|
11922
12042
|
}
|
|
11923
|
-
async function createCards(courseID, datashapeID, noteID, tags, elo = (0,
|
|
12043
|
+
async function createCards(courseID, datashapeID, noteID, tags, elo = (0, import_common16.blankCourseElo)(), author) {
|
|
11924
12044
|
const cfg = await getCredentialledCourseConfig(courseID);
|
|
11925
|
-
const dsDescriptor =
|
|
12045
|
+
const dsDescriptor = import_common15.NameSpacer.getDataShapeDescriptor(datashapeID);
|
|
11926
12046
|
let questionViewTypes = [];
|
|
11927
12047
|
for (const ds of cfg.dataShapes) {
|
|
11928
12048
|
if (ds.name === datashapeID) {
|
|
@@ -11938,8 +12058,8 @@ async function createCards(courseID, datashapeID, noteID, tags, elo = (0, import
|
|
|
11938
12058
|
await createCard(questionView, courseID, dsDescriptor, noteID, tags, elo, author);
|
|
11939
12059
|
}
|
|
11940
12060
|
}
|
|
11941
|
-
async function createCard(questionViewName, courseID, dsDescriptor, noteID, tags, elo = (0,
|
|
11942
|
-
const qDescriptor =
|
|
12061
|
+
async function createCard(questionViewName, courseID, dsDescriptor, noteID, tags, elo = (0, import_common16.blankCourseElo)(), author) {
|
|
12062
|
+
const qDescriptor = import_common15.NameSpacer.getQuestionDescriptor(questionViewName);
|
|
11943
12063
|
const cfg = await getCredentialledCourseConfig(courseID);
|
|
11944
12064
|
for (const rQ of cfg.questionTypes) {
|
|
11945
12065
|
if (rQ.name === questionViewName) {
|
|
@@ -11948,7 +12068,7 @@ async function createCard(questionViewName, courseID, dsDescriptor, noteID, tags
|
|
|
11948
12068
|
courseID,
|
|
11949
12069
|
dsDescriptor.course,
|
|
11950
12070
|
[noteID],
|
|
11951
|
-
|
|
12071
|
+
import_common15.NameSpacer.getViewString({
|
|
11952
12072
|
course: qDescriptor.course,
|
|
11953
12073
|
questionType: qDescriptor.questionType,
|
|
11954
12074
|
view
|
|
@@ -11970,7 +12090,7 @@ async function addCard(courseID, course, id_displayable_data, id_view, elo, tags
|
|
|
11970
12090
|
id_displayable_data,
|
|
11971
12091
|
id_view,
|
|
11972
12092
|
docType: "CARD" /* CARD */,
|
|
11973
|
-
elo: elo || (0,
|
|
12093
|
+
elo: elo || (0, import_common16.toCourseElo)(990 + Math.round(20 * Math.random())),
|
|
11974
12094
|
author
|
|
11975
12095
|
});
|
|
11976
12096
|
for (const tag of tags) {
|
|
@@ -12063,16 +12183,16 @@ function getTagID(tagName) {
|
|
|
12063
12183
|
return tagPrefix + tagName;
|
|
12064
12184
|
}
|
|
12065
12185
|
}
|
|
12066
|
-
var
|
|
12186
|
+
var import_common15, import_common16, import_common17, import_uuid, COURSE_CONFIG_TTL_MS, courseConfigCache, AlreadyTaggedErr;
|
|
12067
12187
|
var init_courseAPI = __esm({
|
|
12068
12188
|
"src/impl/couch/courseAPI.ts"() {
|
|
12069
12189
|
"use strict";
|
|
12070
12190
|
init_couch();
|
|
12071
|
-
import_common14 = require("@vue-skuilder/common");
|
|
12072
12191
|
import_common15 = require("@vue-skuilder/common");
|
|
12192
|
+
import_common16 = require("@vue-skuilder/common");
|
|
12073
12193
|
init_courseDB();
|
|
12074
12194
|
init_types_legacy();
|
|
12075
|
-
|
|
12195
|
+
import_common17 = require("@vue-skuilder/common");
|
|
12076
12196
|
init_common();
|
|
12077
12197
|
init_logger();
|
|
12078
12198
|
import_uuid = require("uuid");
|
|
@@ -12862,11 +12982,11 @@ ${JSON.stringify(config)}
|
|
|
12862
12982
|
function isSuccessRow(row) {
|
|
12863
12983
|
return "doc" in row && row.doc !== null && row.doc !== void 0;
|
|
12864
12984
|
}
|
|
12865
|
-
var
|
|
12985
|
+
var import_common19, CoursesDB, CourseDB;
|
|
12866
12986
|
var init_courseDB = __esm({
|
|
12867
12987
|
"src/impl/couch/courseDB.ts"() {
|
|
12868
12988
|
"use strict";
|
|
12869
|
-
|
|
12989
|
+
import_common19 = require("@vue-skuilder/common");
|
|
12870
12990
|
init_couch();
|
|
12871
12991
|
init_updateQueue();
|
|
12872
12992
|
init_types_legacy();
|
|
@@ -13018,14 +13138,14 @@ var init_courseDB = __esm({
|
|
|
13018
13138
|
docs.rows.forEach((r) => {
|
|
13019
13139
|
if (isSuccessRow(r)) {
|
|
13020
13140
|
if (r.doc && r.doc.elo) {
|
|
13021
|
-
ret.push((0,
|
|
13141
|
+
ret.push((0, import_common19.toCourseElo)(r.doc.elo));
|
|
13022
13142
|
} else {
|
|
13023
13143
|
logger.warn("no elo data for card: " + r.id);
|
|
13024
|
-
ret.push((0,
|
|
13144
|
+
ret.push((0, import_common19.blankCourseElo)());
|
|
13025
13145
|
}
|
|
13026
13146
|
} else {
|
|
13027
13147
|
logger.warn("no elo data for card: " + JSON.stringify(r));
|
|
13028
|
-
ret.push((0,
|
|
13148
|
+
ret.push((0, import_common19.blankCourseElo)());
|
|
13029
13149
|
}
|
|
13030
13150
|
});
|
|
13031
13151
|
return ret;
|
|
@@ -13223,7 +13343,7 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
13223
13343
|
async getCourseTagStubs() {
|
|
13224
13344
|
return filterAllDocsByPrefix2(this.db, "TAG" /* TAG */.valueOf() + "-");
|
|
13225
13345
|
}
|
|
13226
|
-
async addNote(codeCourse, shape, data, author, tags, uploads, elo = (0,
|
|
13346
|
+
async addNote(codeCourse, shape, data, author, tags, uploads, elo = (0, import_common19.blankCourseElo)()) {
|
|
13227
13347
|
try {
|
|
13228
13348
|
const resp = await addNote55(this.id, codeCourse, shape, data, author, tags, uploads, elo);
|
|
13229
13349
|
if (resp.ok) {
|
|
@@ -13232,19 +13352,19 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
13232
13352
|
`[courseDB.addNote] Note added but card creation failed: ${resp.cardCreationError}`
|
|
13233
13353
|
);
|
|
13234
13354
|
return {
|
|
13235
|
-
status:
|
|
13355
|
+
status: import_common19.Status.error,
|
|
13236
13356
|
message: `Note was added but no cards were created: ${resp.cardCreationError}`,
|
|
13237
13357
|
id: resp.id
|
|
13238
13358
|
};
|
|
13239
13359
|
}
|
|
13240
13360
|
return {
|
|
13241
|
-
status:
|
|
13361
|
+
status: import_common19.Status.ok,
|
|
13242
13362
|
message: "",
|
|
13243
13363
|
id: resp.id
|
|
13244
13364
|
};
|
|
13245
13365
|
} else {
|
|
13246
13366
|
return {
|
|
13247
|
-
status:
|
|
13367
|
+
status: import_common19.Status.error,
|
|
13248
13368
|
message: "Unexpected error adding note"
|
|
13249
13369
|
};
|
|
13250
13370
|
}
|
|
@@ -13256,7 +13376,7 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
|
|
|
13256
13376
|
message: ${err.message}`
|
|
13257
13377
|
);
|
|
13258
13378
|
return {
|
|
13259
|
-
status:
|
|
13379
|
+
status: import_common19.Status.error,
|
|
13260
13380
|
message: `Error adding note to course. ${e.reason || err.message}`
|
|
13261
13381
|
};
|
|
13262
13382
|
}
|
|
@@ -13463,7 +13583,7 @@ ${e.stack}` : JSON.stringify(e);
|
|
|
13463
13583
|
const courseDoc = (await u.getCourseRegistrationsDoc()).courses.find((c) => {
|
|
13464
13584
|
return c.courseID === this.id;
|
|
13465
13585
|
});
|
|
13466
|
-
targetElo = (0,
|
|
13586
|
+
targetElo = (0, import_common19.EloToNumber)(courseDoc.elo);
|
|
13467
13587
|
} catch {
|
|
13468
13588
|
targetElo = 1e3;
|
|
13469
13589
|
}
|
|
@@ -13993,14 +14113,14 @@ var CouchDBSyncStrategy_exports = {};
|
|
|
13993
14113
|
__export(CouchDBSyncStrategy_exports, {
|
|
13994
14114
|
CouchDBSyncStrategy: () => CouchDBSyncStrategy
|
|
13995
14115
|
});
|
|
13996
|
-
var
|
|
14116
|
+
var import_common20, log4, CouchDBSyncStrategy;
|
|
13997
14117
|
var init_CouchDBSyncStrategy = __esm({
|
|
13998
14118
|
"src/impl/couch/CouchDBSyncStrategy.ts"() {
|
|
13999
14119
|
"use strict";
|
|
14000
14120
|
init_factory();
|
|
14001
14121
|
init_types_legacy();
|
|
14002
14122
|
init_logger();
|
|
14003
|
-
|
|
14123
|
+
import_common20 = require("@vue-skuilder/common");
|
|
14004
14124
|
init_common();
|
|
14005
14125
|
init_pouchdb_setup();
|
|
14006
14126
|
init_couch();
|
|
@@ -14141,32 +14261,32 @@ var init_CouchDBSyncStrategy = __esm({
|
|
|
14141
14261
|
}
|
|
14142
14262
|
}
|
|
14143
14263
|
return {
|
|
14144
|
-
status:
|
|
14264
|
+
status: import_common20.Status.ok,
|
|
14145
14265
|
error: void 0
|
|
14146
14266
|
};
|
|
14147
14267
|
} else {
|
|
14148
14268
|
return {
|
|
14149
|
-
status:
|
|
14269
|
+
status: import_common20.Status.error,
|
|
14150
14270
|
error: "Failed to log in after account creation"
|
|
14151
14271
|
};
|
|
14152
14272
|
}
|
|
14153
14273
|
} else {
|
|
14154
14274
|
logger.warn(`Signup not OK: ${JSON.stringify(signupRequest)}`);
|
|
14155
14275
|
return {
|
|
14156
|
-
status:
|
|
14276
|
+
status: import_common20.Status.error,
|
|
14157
14277
|
error: "Account creation failed"
|
|
14158
14278
|
};
|
|
14159
14279
|
}
|
|
14160
14280
|
} catch (e) {
|
|
14161
14281
|
if (e.reason === "Document update conflict.") {
|
|
14162
14282
|
return {
|
|
14163
|
-
status:
|
|
14283
|
+
status: import_common20.Status.error,
|
|
14164
14284
|
error: "This username is taken!"
|
|
14165
14285
|
};
|
|
14166
14286
|
}
|
|
14167
14287
|
logger.error(`Error on signup: ${JSON.stringify(e)}`);
|
|
14168
14288
|
return {
|
|
14169
|
-
status:
|
|
14289
|
+
status: import_common20.Status.error,
|
|
14170
14290
|
error: e.message || "Unknown error during account creation"
|
|
14171
14291
|
};
|
|
14172
14292
|
}
|
|
@@ -15300,11 +15420,11 @@ var init_StaticDataUnpacker = __esm({
|
|
|
15300
15420
|
});
|
|
15301
15421
|
|
|
15302
15422
|
// src/impl/static/courseDB.ts
|
|
15303
|
-
var
|
|
15423
|
+
var import_common23, StaticCourseDB;
|
|
15304
15424
|
var init_courseDB2 = __esm({
|
|
15305
15425
|
"src/impl/static/courseDB.ts"() {
|
|
15306
15426
|
"use strict";
|
|
15307
|
-
|
|
15427
|
+
import_common23 = require("@vue-skuilder/common");
|
|
15308
15428
|
init_types_legacy();
|
|
15309
15429
|
init_logger();
|
|
15310
15430
|
init_defaults();
|
|
@@ -15565,7 +15685,7 @@ var init_courseDB2 = __esm({
|
|
|
15565
15685
|
}
|
|
15566
15686
|
async addNote(_codeCourse, _shape, _data, _author, _tags, _uploads, _elo) {
|
|
15567
15687
|
return {
|
|
15568
|
-
status:
|
|
15688
|
+
status: import_common23.Status.error,
|
|
15569
15689
|
message: "Cannot add notes in static mode"
|
|
15570
15690
|
};
|
|
15571
15691
|
}
|
|
@@ -16337,19 +16457,19 @@ async function getStudySource(source, user) {
|
|
|
16337
16457
|
if (source.type === "classroom") {
|
|
16338
16458
|
return await StudentClassroomDB.factory(source.id, user);
|
|
16339
16459
|
} else {
|
|
16340
|
-
if ((0,
|
|
16460
|
+
if ((0, import_common26.hasActiveFilter)(source.tagFilter)) {
|
|
16341
16461
|
return new TagFilteredContentSource(source.id, source.tagFilter, user);
|
|
16342
16462
|
}
|
|
16343
16463
|
return getDataLayer().getCourseDB(source.id);
|
|
16344
16464
|
}
|
|
16345
16465
|
}
|
|
16346
|
-
var
|
|
16466
|
+
var import_common26;
|
|
16347
16467
|
var init_contentSource = __esm({
|
|
16348
16468
|
"src/core/interfaces/contentSource.ts"() {
|
|
16349
16469
|
"use strict";
|
|
16350
16470
|
init_factory();
|
|
16351
16471
|
init_classroomDB2();
|
|
16352
|
-
|
|
16472
|
+
import_common26 = require("@vue-skuilder/common");
|
|
16353
16473
|
init_TagFilteredContentSource();
|
|
16354
16474
|
}
|
|
16355
16475
|
});
|
|
@@ -16489,7 +16609,7 @@ elo: ${elo}`;
|
|
|
16489
16609
|
misc: {}
|
|
16490
16610
|
} : void 0
|
|
16491
16611
|
);
|
|
16492
|
-
if (result.status ===
|
|
16612
|
+
if (result.status === import_common27.Status.ok) {
|
|
16493
16613
|
return {
|
|
16494
16614
|
originalText,
|
|
16495
16615
|
status: "success",
|
|
@@ -16533,11 +16653,11 @@ function validateProcessorConfig(config) {
|
|
|
16533
16653
|
}
|
|
16534
16654
|
return { isValid: true };
|
|
16535
16655
|
}
|
|
16536
|
-
var
|
|
16656
|
+
var import_common27;
|
|
16537
16657
|
var init_cardProcessor = __esm({
|
|
16538
16658
|
"src/core/bulkImport/cardProcessor.ts"() {
|
|
16539
16659
|
"use strict";
|
|
16540
|
-
|
|
16660
|
+
import_common27 = require("@vue-skuilder/common");
|
|
16541
16661
|
init_logger();
|
|
16542
16662
|
}
|
|
16543
16663
|
});
|
|
@@ -16712,10 +16832,10 @@ init_regulators();
|
|
|
16712
16832
|
init_courseLookupDB();
|
|
16713
16833
|
|
|
16714
16834
|
// src/courseConfigRegistration.ts
|
|
16715
|
-
var
|
|
16835
|
+
var import_common28 = require("@vue-skuilder/common");
|
|
16716
16836
|
init_logger();
|
|
16717
16837
|
function isDataShapeRegistered(dataShape, courseConfig) {
|
|
16718
|
-
const namespacedName =
|
|
16838
|
+
const namespacedName = import_common28.NameSpacer.getDataShapeString({
|
|
16719
16839
|
dataShape: dataShape.name,
|
|
16720
16840
|
course: dataShape.course
|
|
16721
16841
|
});
|
|
@@ -16723,7 +16843,7 @@ function isDataShapeRegistered(dataShape, courseConfig) {
|
|
|
16723
16843
|
return existingDataShape !== void 0;
|
|
16724
16844
|
}
|
|
16725
16845
|
function isDataShapeSchemaAvailable(dataShape, courseConfig) {
|
|
16726
|
-
const namespacedName =
|
|
16846
|
+
const namespacedName = import_common28.NameSpacer.getDataShapeString({
|
|
16727
16847
|
dataShape: dataShape.name,
|
|
16728
16848
|
course: dataShape.course
|
|
16729
16849
|
});
|
|
@@ -16731,7 +16851,7 @@ function isDataShapeSchemaAvailable(dataShape, courseConfig) {
|
|
|
16731
16851
|
return existingDataShape !== void 0 && existingDataShape.serializedZodSchema !== void 0;
|
|
16732
16852
|
}
|
|
16733
16853
|
function isQuestionTypeRegistered(question, courseConfig) {
|
|
16734
|
-
const namespacedName =
|
|
16854
|
+
const namespacedName = import_common28.NameSpacer.getQuestionString({
|
|
16735
16855
|
course: question.course,
|
|
16736
16856
|
questionType: question.name
|
|
16737
16857
|
});
|
|
@@ -16763,13 +16883,13 @@ function processCustomQuestionsData(customQuestions) {
|
|
|
16763
16883
|
return { dataShapes: processedDataShapes, questions: processedQuestions };
|
|
16764
16884
|
}
|
|
16765
16885
|
function registerDataShape(dataShape, courseConfig) {
|
|
16766
|
-
const namespacedName =
|
|
16886
|
+
const namespacedName = import_common28.NameSpacer.getDataShapeString({
|
|
16767
16887
|
dataShape: dataShape.name,
|
|
16768
16888
|
course: dataShape.course
|
|
16769
16889
|
});
|
|
16770
16890
|
let serializedZodSchema;
|
|
16771
16891
|
try {
|
|
16772
|
-
serializedZodSchema = (0,
|
|
16892
|
+
serializedZodSchema = (0, import_common28.toZodJSON)(dataShape.dataShape);
|
|
16773
16893
|
} catch (error) {
|
|
16774
16894
|
logger.warn(`Failed to generate schema for ${namespacedName}:`, error);
|
|
16775
16895
|
serializedZodSchema = void 0;
|
|
@@ -16814,7 +16934,7 @@ function registerQuestionType(question, courseConfig) {
|
|
|
16814
16934
|
logger.info(`QuestionType '${question.name}' from '${question.course}' already registered`);
|
|
16815
16935
|
return false;
|
|
16816
16936
|
}
|
|
16817
|
-
const namespacedQuestionName =
|
|
16937
|
+
const namespacedQuestionName = import_common28.NameSpacer.getQuestionString({
|
|
16818
16938
|
course: question.course,
|
|
16819
16939
|
questionType: question.name
|
|
16820
16940
|
});
|
|
@@ -16826,7 +16946,7 @@ function registerQuestionType(question, courseConfig) {
|
|
|
16826
16946
|
}
|
|
16827
16947
|
});
|
|
16828
16948
|
const dataShapeList = question.dataShapes.map(
|
|
16829
|
-
(dataShape) =>
|
|
16949
|
+
(dataShape) => import_common28.NameSpacer.getDataShapeString({
|
|
16830
16950
|
course: question.course,
|
|
16831
16951
|
dataShape: dataShape.name
|
|
16832
16952
|
})
|
|
@@ -16837,7 +16957,7 @@ function registerQuestionType(question, courseConfig) {
|
|
|
16837
16957
|
dataShapeList
|
|
16838
16958
|
});
|
|
16839
16959
|
question.dataShapes.forEach((dataShape) => {
|
|
16840
|
-
const namespacedDataShapeName =
|
|
16960
|
+
const namespacedDataShapeName = import_common28.NameSpacer.getDataShapeString({
|
|
16841
16961
|
course: question.course,
|
|
16842
16962
|
dataShape: dataShape.name
|
|
16843
16963
|
});
|
|
@@ -16924,7 +17044,7 @@ async function registerSeedData(question, courseDB, username) {
|
|
|
16924
17044
|
username,
|
|
16925
17045
|
meta.tags ?? [],
|
|
16926
17046
|
void 0,
|
|
16927
|
-
meta.elo !== void 0 ? (0,
|
|
17047
|
+
meta.elo !== void 0 ? (0, import_common28.toCourseElo)(meta.elo) : void 0
|
|
16928
17048
|
);
|
|
16929
17049
|
}
|
|
16930
17050
|
}
|