Skip to content

Commit

Permalink
feat: user can quiz for many times in RetrieveQuestions
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Apr 4, 2024
1 parent 7cde08f commit 54136eb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apis/question.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
return
}

user, err := LoadUserFromDB(userID)
_, err = LoadUserFromDB(userID)
if err != nil {
return
}

if user.HasAnsweredQuestions {
return common.BadRequest("you have answered questions")
}
//if user.HasAnsweredQuestions {
// return common.BadRequest("you have answered questions")
//}

version := c.QueryInt("version")
if version == 0 {
Expand Down Expand Up @@ -246,6 +246,7 @@ func AnswerQuestions(c *fiber.Ctx) (err error) {
})
}

user.HasAnsweredQuestions = true
err = DB.Model(&user).Update("has_answered_questions", true).Error
if err != nil {
return
Expand Down

0 comments on commit 54136eb

Please sign in to comment.