@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.
@@ -2212,7 +2212,26 @@ var init_srs = __esm({
2212
2212
  const courseId = this.course.getCourseID();
2213
2213
  const reviews = await this.user.getPendingReviews(courseId);
2214
2214
  const now = import_moment3.default.utc();
2215
- const dueReviews = reviews.filter((r) => now.isAfter(import_moment3.default.utc(r.reviewTime)));
2215
+ let dueReviews = reviews.filter((r) => now.isAfter(import_moment3.default.utc(r.reviewTime)));
2216
+ if (dueReviews.length > 0) {
2217
+ const dueCardIds = [...new Set(dueReviews.map((r) => r.cardId))];
2218
+ const tagsByCard = await this.course.getAppliedTagsBatch(dueCardIds);
2219
+ const skippedReviewIds = [];
2220
+ dueReviews = dueReviews.filter((r) => {
2221
+ const tags = tagsByCard.get(r.cardId) ?? [];
2222
+ if (tags.includes("srs:skip")) {
2223
+ skippedReviewIds.push(r._id);
2224
+ return false;
2225
+ }
2226
+ return true;
2227
+ });
2228
+ if (skippedReviewIds.length > 0) {
2229
+ logger.info(`[SRS] Removing ${skippedReviewIds.length} scheduled reviews for srs:skip cards`);
2230
+ for (const id of skippedReviewIds) {
2231
+ void this.user.removeScheduledCardReview(id);
2232
+ }
2233
+ }
2234
+ }
2216
2235
  const backlogPressure = this.computeBacklogPressure(dueReviews.length);
2217
2236
  if (dueReviews.length > 0) {
2218
2237
  const pressureNote = backlogPressure > 0 ? ` [backlog pressure: +${backlogPressure.toFixed(2)}]` : ` [healthy backlog]`;
@@ -5615,17 +5634,18 @@ Currently logged-in as ${this._username}.`
5615
5634
  * @param course_id optional specification of individual course
5616
5635
  */
5617
5636
  async getSeenCards(course_id) {
5618
- let prefix = DocTypePrefixes["CARDRECORD" /* CARDRECORD */];
5637
+ const basePrefix = DocTypePrefixes["CARDRECORD" /* CARDRECORD */];
5638
+ let filterPrefix = basePrefix;
5619
5639
  if (course_id) {
5620
- prefix += course_id;
5640
+ filterPrefix += `-${course_id}-`;
5621
5641
  }
5622
- const docs = await filterAllDocsByPrefix(this.localDB, prefix, {
5642
+ const docs = await filterAllDocsByPrefix(this.localDB, filterPrefix, {
5623
5643
  include_docs: false
5624
5644
  });
5625
5645
  const ret = [];
5626
5646
  docs.rows.forEach((row) => {
5627
- if (row.id.startsWith(DocTypePrefixes["CARDRECORD" /* CARDRECORD */])) {
5628
- ret.push(row.id.substr(DocTypePrefixes["CARDRECORD" /* CARDRECORD */].length));
5647
+ if (row.id.startsWith(filterPrefix)) {
5648
+ ret.push(row.id.substr(filterPrefix.length));
5629
5649
  }
5630
5650
  });
5631
5651
  return ret;