@vue-skuilder/db 0.1.33 → 0.1.34
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 +26 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +26 -6
- package/dist/core/index.mjs.map +1 -1
- package/dist/impl/couch/index.js +26 -6
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +26 -6
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.js +26 -6
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +26 -6
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +62 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/navigators/generators/srs.ts +23 -1
- package/src/impl/common/BaseUserDB.ts +9 -6
- package/src/study/SessionController.ts +50 -20
- package/src/study/services/ResponseProcessor.ts +5 -1
package/dist/core/index.js
CHANGED
|
@@ -2409,7 +2409,26 @@ var init_srs = __esm({
|
|
|
2409
2409
|
const courseId = this.course.getCourseID();
|
|
2410
2410
|
const reviews = await this.user.getPendingReviews(courseId);
|
|
2411
2411
|
const now = import_moment3.default.utc();
|
|
2412
|
-
|
|
2412
|
+
let dueReviews = reviews.filter((r) => now.isAfter(import_moment3.default.utc(r.reviewTime)));
|
|
2413
|
+
if (dueReviews.length > 0) {
|
|
2414
|
+
const dueCardIds = [...new Set(dueReviews.map((r) => r.cardId))];
|
|
2415
|
+
const tagsByCard = await this.course.getAppliedTagsBatch(dueCardIds);
|
|
2416
|
+
const skippedReviewIds = [];
|
|
2417
|
+
dueReviews = dueReviews.filter((r) => {
|
|
2418
|
+
const tags = tagsByCard.get(r.cardId) ?? [];
|
|
2419
|
+
if (tags.includes("srs:skip")) {
|
|
2420
|
+
skippedReviewIds.push(r._id);
|
|
2421
|
+
return false;
|
|
2422
|
+
}
|
|
2423
|
+
return true;
|
|
2424
|
+
});
|
|
2425
|
+
if (skippedReviewIds.length > 0) {
|
|
2426
|
+
logger.info(`[SRS] Removing ${skippedReviewIds.length} scheduled reviews for srs:skip cards`);
|
|
2427
|
+
for (const id of skippedReviewIds) {
|
|
2428
|
+
void this.user.removeScheduledCardReview(id);
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2413
2432
|
const backlogPressure = this.computeBacklogPressure(dueReviews.length);
|
|
2414
2433
|
if (dueReviews.length > 0) {
|
|
2415
2434
|
const pressureNote = backlogPressure > 0 ? ` [backlog pressure: +${backlogPressure.toFixed(2)}]` : ` [healthy backlog]`;
|
|
@@ -6853,17 +6872,18 @@ Currently logged-in as ${this._username}.`
|
|
|
6853
6872
|
* @param course_id optional specification of individual course
|
|
6854
6873
|
*/
|
|
6855
6874
|
async getSeenCards(course_id) {
|
|
6856
|
-
|
|
6875
|
+
const basePrefix = DocTypePrefixes["CARDRECORD" /* CARDRECORD */];
|
|
6876
|
+
let filterPrefix = basePrefix;
|
|
6857
6877
|
if (course_id) {
|
|
6858
|
-
|
|
6878
|
+
filterPrefix += `-${course_id}-`;
|
|
6859
6879
|
}
|
|
6860
|
-
const docs = await filterAllDocsByPrefix(this.localDB,
|
|
6880
|
+
const docs = await filterAllDocsByPrefix(this.localDB, filterPrefix, {
|
|
6861
6881
|
include_docs: false
|
|
6862
6882
|
});
|
|
6863
6883
|
const ret = [];
|
|
6864
6884
|
docs.rows.forEach((row) => {
|
|
6865
|
-
if (row.id.startsWith(
|
|
6866
|
-
ret.push(row.id.substr(
|
|
6885
|
+
if (row.id.startsWith(filterPrefix)) {
|
|
6886
|
+
ret.push(row.id.substr(filterPrefix.length));
|
|
6867
6887
|
}
|
|
6868
6888
|
});
|
|
6869
6889
|
return ret;
|