@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.
@@ -2333,7 +2333,26 @@ var init_srs = __esm({
2333
2333
  const courseId = this.course.getCourseID();
2334
2334
  const reviews = await this.user.getPendingReviews(courseId);
2335
2335
  const now = import_moment.default.utc();
2336
- const dueReviews = reviews.filter((r) => now.isAfter(import_moment.default.utc(r.reviewTime)));
2336
+ let dueReviews = reviews.filter((r) => now.isAfter(import_moment.default.utc(r.reviewTime)));
2337
+ if (dueReviews.length > 0) {
2338
+ const dueCardIds = [...new Set(dueReviews.map((r) => r.cardId))];
2339
+ const tagsByCard = await this.course.getAppliedTagsBatch(dueCardIds);
2340
+ const skippedReviewIds = [];
2341
+ dueReviews = dueReviews.filter((r) => {
2342
+ const tags = tagsByCard.get(r.cardId) ?? [];
2343
+ if (tags.includes("srs:skip")) {
2344
+ skippedReviewIds.push(r._id);
2345
+ return false;
2346
+ }
2347
+ return true;
2348
+ });
2349
+ if (skippedReviewIds.length > 0) {
2350
+ logger.info(`[SRS] Removing ${skippedReviewIds.length} scheduled reviews for srs:skip cards`);
2351
+ for (const id of skippedReviewIds) {
2352
+ void this.user.removeScheduledCardReview(id);
2353
+ }
2354
+ }
2355
+ }
2337
2356
  const backlogPressure = this.computeBacklogPressure(dueReviews.length);
2338
2357
  if (dueReviews.length > 0) {
2339
2358
  const pressureNote = backlogPressure > 0 ? ` [backlog pressure: +${backlogPressure.toFixed(2)}]` : ` [healthy backlog]`;
@@ -7480,17 +7499,18 @@ Currently logged-in as ${this._username}.`
7480
7499
  * @param course_id optional specification of individual course
7481
7500
  */
7482
7501
  async getSeenCards(course_id) {
7483
- let prefix = DocTypePrefixes["CARDRECORD" /* CARDRECORD */];
7502
+ const basePrefix = DocTypePrefixes["CARDRECORD" /* CARDRECORD */];
7503
+ let filterPrefix = basePrefix;
7484
7504
  if (course_id) {
7485
- prefix += course_id;
7505
+ filterPrefix += `-${course_id}-`;
7486
7506
  }
7487
- const docs = await filterAllDocsByPrefix2(this.localDB, prefix, {
7507
+ const docs = await filterAllDocsByPrefix2(this.localDB, filterPrefix, {
7488
7508
  include_docs: false
7489
7509
  });
7490
7510
  const ret = [];
7491
7511
  docs.rows.forEach((row) => {
7492
- if (row.id.startsWith(DocTypePrefixes["CARDRECORD" /* CARDRECORD */])) {
7493
- ret.push(row.id.substr(DocTypePrefixes["CARDRECORD" /* CARDRECORD */].length));
7512
+ if (row.id.startsWith(filterPrefix)) {
7513
+ ret.push(row.id.substr(filterPrefix.length));
7494
7514
  }
7495
7515
  });
7496
7516
  return ret;