Skip to content

Commit

Permalink
Avoid exception when deck isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk committed Dec 9, 2023
1 parent 6d32c0c commit 8eed792
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions functions/services/review-card.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ test("difficult to remember card", () => {
"wrong",
"correct",
"wrong",
"wrong",
"correct",
"correct",
"correct",
]);

expect(intervals).toEqual([0.4, 0.94, 0.4, 0.4, 0.86, 1.94, 4.56]);
expect(intervals).toEqual([0.4, 0.94, 0.4, 0.92, 2.21, 5.53]);
});

test("forgetting resets interval - non interrupted", () => {
Expand Down
5 changes: 3 additions & 2 deletions src/store/deck-list-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ export class DeckListStore {
const deckIndex = this.myInfo.value.myDecks.findIndex(
(myDeck) => myDeck.id === deck.id,
);
assert(deckIndex !== -1, "Deck not found in myDecks");
this.myInfo.value.myDecks[deckIndex] = deck;
if (deckIndex !== -1) {
this.myInfo.value.myDecks[deckIndex] = deck;
}
}

get publicDecks() {
Expand Down

0 comments on commit 8eed792

Please sign in to comment.