diff options
author | polwex <polwex@sortug.com> | 2025-05-29 16:25:31 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-05-29 16:25:31 +0700 |
commit | a03c92dc82ad527d7da6bbaa3c43000e2e5f0e69 (patch) | |
tree | 9a47cae250d043d31f751c1383bdcbe09d4bc9d8 /src/lib/services | |
parent | 7de09570c0d7907424c30f492207e80ff69e4061 (diff) |
better better
Diffstat (limited to 'src/lib/services')
-rw-r--r-- | src/lib/services/srs_study.ts | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/lib/services/srs_study.ts b/src/lib/services/srs_study.ts index 9223722..0930795 100644 --- a/src/lib/services/srs_study.ts +++ b/src/lib/services/srs_study.ts @@ -309,27 +309,14 @@ export class SRSStudyService { // Record the attempt this.recordAttempt(userId, cardId, accuracy > 0.6 ? 1 : 0, reviewTime); - // Fetch updated card data - const updatedDeckResponse = this.db.fetchLesson({ - userId, - lessonId: 0, // We don't care about lesson context here - count: 1, - page: 1, - }); + // Fetch updated card data using the fetchCardById method + const updatedCardResponse = this.db.fetchCardById(cardId, userId); - if ("error" in updatedDeckResponse) { + if ("error" in updatedCardResponse) { return { error: "Failed to fetch updated card data" }; } - // Find the updated card - const updatedCard = updatedDeckResponse.ok.cards.find( - (c) => c.id === cardId, - ); - if (!updatedCard) { - return { error: "Failed to retrieve updated card" }; - } - - return updatedCard; + return updatedCardResponse.ok; } /** |