Skip to content

Commit 3421aed

Browse files
authored
Docs copy 2 (#905)
2 parents 289598c + 59bf79d commit 3421aed

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

docs/assets/audio-card.png

8.7 KB
Loading

docs/learn/cards.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,14 @@ Including, eg, code blocks:
136136

137137
Basic cards support media (audio, image) that has been bundled with the card. Porting that process to this docs site is a work in progress, but the rough picture is this:
138138

139+
#### Images
140+
139141
![Card with a Heart](../assets/img-card.png)
140142

143+
#### Audio
144+
145+
![Card with Sound](../assets/audio-card.png)
146+
141147
## General Content Embedding
142148

143149
If it's markdown, it mostly just works. For example, this youtube embed.

packages/db/src/impl/couch/courseDB.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,29 @@ export class CourseDB implements StudyContentSource, CourseDBInterface {
225225
if (!doc.docType || !(doc.docType === DocType.CARD)) {
226226
throw new Error(`failed to remove ${id} from course ${this.id}. id does not point to a card`);
227227
}
228-
// TODO: remove card from tags lists (getTagsByCards)
228+
229+
// Remove card from all associated tags before deleting the card
230+
try {
231+
const appliedTags = await this.getAppliedTags(id);
232+
const results = await Promise.allSettled(
233+
appliedTags.rows.map(async (tagRow) => {
234+
const tagId = tagRow.id;
235+
await this.removeTagFromCard(id, tagId);
236+
})
237+
);
238+
239+
// Log any individual tag cleanup failures
240+
results.forEach((result, index) => {
241+
if (result.status === 'rejected') {
242+
const tagId = appliedTags.rows[index].id;
243+
logger.error(`Failed to remove card ${id} from tag ${tagId}: ${result.reason}`);
244+
}
245+
});
246+
} catch (error) {
247+
logger.error(`Error removing card ${id} from tags: ${error}`);
248+
// Continue with card deletion even if tag cleanup fails
249+
}
250+
229251
return this.db.remove(doc);
230252
}
231253

0 commit comments

Comments
 (0)