paper, quiz 상태 변경

This commit is contained in:
JongYeob Sheen 2024-02-19 23:17:41 +09:00
parent 0bac2bc670
commit ad7b1db9cd
2 changed files with 7 additions and 7 deletions

View File

@ -219,7 +219,7 @@ func (controller *paperController) Finish(c *gin.Context) {
}
now := time.Now()
paper.Status = "finish"
paper.Status = "done"
paper.DoneAt = &now
result, err := controller.service.Update(paper)
@ -399,14 +399,14 @@ func (controller *paperController) QuizAnswer(c *gin.Context) {
isCorrect := cmp.Equal(quiz.Answer.String(), userAnswer.String())
var score float32 = 0.0
var correction string = "wrong"
var correction string = "fail"
if isCorrect {
score = 1.0
correction = "correct"
correction = "success"
}
userquiz.Answer = userAnswer
userquiz.Status = "answer"
userquiz.Status = "done"
userquiz.Result = correction
userquiz.Score = score

View File

@ -311,14 +311,14 @@ func (controller *userQuizController) Answer(c *gin.Context) {
isCorrect := cmp.Equal(quiz.Answer.String(), userAnswer.String())
var score float32 = 0.0
var correction string = "wrong"
var correction string = "fail"
if isCorrect {
score = 1.0
correction = "correct"
correction = "success"
}
userquiz.Answer = userAnswer
userquiz.Status = "answer"
userquiz.Status = "done"
userquiz.Result = correction
userquiz.Score = score