Skip to content

Commit

Permalink
Fix userduecards
Browse files Browse the repository at this point in the history
  • Loading branch information
TomRomeo committed Apr 4, 2024
1 parent 996f20b commit 8915cb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/services/frontend/handler/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (e *Frontend) SrsUserDueHandler(c *fiber.Ctx) error {
}
dueCards += rsp.DueCards
newCards += rsp.NewCards
if rsp.DueCards > 0 {
if rsp.DueCards > 0 || rsp.NewCards > 0 {
dueDecks++
}
case pbCommon.AlgoType_LINEAR_SRS:
Expand All @@ -248,7 +248,7 @@ func (e *Frontend) SrsUserDueHandler(c *fiber.Ctx) error {
}
dueCards += rsp.DueCards
newCards += rsp.NewCards
if rsp.DueCards > 0 {
if rsp.DueCards > 0 || rsp.NewCards > 0 {
dueDecks++
}
case pbCommon.AlgoType_STATIC_SRS:
Expand All @@ -263,7 +263,7 @@ func (e *Frontend) SrsUserDueHandler(c *fiber.Ctx) error {
}
dueCards += rsp.DueCards
newCards += rsp.NewCards
if rsp.DueCards > 0 {
if rsp.DueCards > 0 || rsp.NewCards > 0 {
dueDecks++
}
case pbCommon.AlgoType_TEST_SRS:
Expand All @@ -278,14 +278,14 @@ func (e *Frontend) SrsUserDueHandler(c *fiber.Ctx) error {
}
dueCards += rsp.DueCards
newCards += rsp.NewCards
if rsp.DueCards > 0 {
if rsp.DueCards > 0 || rsp.NewCards > 0 {
dueDecks++
}
}
}
return c.JSON(converter.FiberGetDueResponseBody{
DueCards: dueCards,
NewCards: int64(newCards),
NewCards: newCards,
DueDecks: dueDecks,
})
}
Expand Down
1 change: 1 addition & 0 deletions backend/store/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ func (s *CardDeckStoreImpl) FindActiveDecks(ctx context.Context, userID string)
}
for _, deck := range userActiveDecks {
deck.Deck.IsActive = true
deck.Deck.Algorithm = deck.Algorithm
if err = s.PopulateDeckFavoriteAttribute(ctx, &deck.Deck, userID); err != nil {
return
}
Expand Down

0 comments on commit 8915cb6

Please sign in to comment.