@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.
@@ -2386,7 +2386,26 @@ var init_srs = __esm({
2386
2386
  const courseId = this.course.getCourseID();
2387
2387
  const reviews = await this.user.getPendingReviews(courseId);
2388
2388
  const now = moment3.utc();
2389
- const dueReviews = reviews.filter((r) => now.isAfter(moment3.utc(r.reviewTime)));
2389
+ let dueReviews = reviews.filter((r) => now.isAfter(moment3.utc(r.reviewTime)));
2390
+ if (dueReviews.length > 0) {
2391
+ const dueCardIds = [...new Set(dueReviews.map((r) => r.cardId))];
2392
+ const tagsByCard = await this.course.getAppliedTagsBatch(dueCardIds);
2393
+ const skippedReviewIds = [];
2394
+ dueReviews = dueReviews.filter((r) => {
2395
+ const tags = tagsByCard.get(r.cardId) ?? [];
2396
+ if (tags.includes("srs:skip")) {
2397
+ skippedReviewIds.push(r._id);
2398
+ return false;
2399
+ }
2400
+ return true;
2401
+ });
2402
+ if (skippedReviewIds.length > 0) {
2403
+ logger.info(`[SRS] Removing ${skippedReviewIds.length} scheduled reviews for srs:skip cards`);
2404
+ for (const id of skippedReviewIds) {
2405
+ void this.user.removeScheduledCardReview(id);
2406
+ }
2407
+ }
2408
+ }
2390
2409
  const backlogPressure = this.computeBacklogPressure(dueReviews.length);
2391
2410
  if (dueReviews.length > 0) {
2392
2411
  const pressureNote = backlogPressure > 0 ? ` [backlog pressure: +${backlogPressure.toFixed(2)}]` : ` [healthy backlog]`;
@@ -6833,17 +6852,18 @@ Currently logged-in as ${this._username}.`
6833
6852
  * @param course_id optional specification of individual course
6834
6853
  */
6835
6854
  async getSeenCards(course_id) {
6836
- let prefix = DocTypePrefixes["CARDRECORD" /* CARDRECORD */];
6855
+ const basePrefix = DocTypePrefixes["CARDRECORD" /* CARDRECORD */];
6856
+ let filterPrefix = basePrefix;
6837
6857
  if (course_id) {
6838
- prefix += course_id;
6858
+ filterPrefix += `-${course_id}-`;
6839
6859
  }
6840
- const docs = await filterAllDocsByPrefix(this.localDB, prefix, {
6860
+ const docs = await filterAllDocsByPrefix(this.localDB, filterPrefix, {
6841
6861
  include_docs: false
6842
6862
  });
6843
6863
  const ret = [];
6844
6864
  docs.rows.forEach((row) => {
6845
- if (row.id.startsWith(DocTypePrefixes["CARDRECORD" /* CARDRECORD */])) {
6846
- ret.push(row.id.substr(DocTypePrefixes["CARDRECORD" /* CARDRECORD */].length));
6865
+ if (row.id.startsWith(filterPrefix)) {
6866
+ ret.push(row.id.substr(filterPrefix.length));
6847
6867
  }
6848
6868
  });
6849
6869
  return ret;