summaryrefslogtreecommitdiff
path: root/src/lib/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/services')
-rw-r--r--src/lib/services/srs_study.ts21
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;
}
/**