paper, quiz 상태 변경
This commit is contained in:
parent
0bac2bc670
commit
ad7b1db9cd
@ -219,7 +219,7 @@ func (controller *paperController) Finish(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
paper.Status = "finish"
|
paper.Status = "done"
|
||||||
paper.DoneAt = &now
|
paper.DoneAt = &now
|
||||||
|
|
||||||
result, err := controller.service.Update(paper)
|
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())
|
isCorrect := cmp.Equal(quiz.Answer.String(), userAnswer.String())
|
||||||
var score float32 = 0.0
|
var score float32 = 0.0
|
||||||
var correction string = "wrong"
|
var correction string = "fail"
|
||||||
if isCorrect {
|
if isCorrect {
|
||||||
score = 1.0
|
score = 1.0
|
||||||
correction = "correct"
|
correction = "success"
|
||||||
}
|
}
|
||||||
|
|
||||||
userquiz.Answer = userAnswer
|
userquiz.Answer = userAnswer
|
||||||
userquiz.Status = "answer"
|
userquiz.Status = "done"
|
||||||
userquiz.Result = correction
|
userquiz.Result = correction
|
||||||
userquiz.Score = score
|
userquiz.Score = score
|
||||||
|
|
||||||
|
@ -311,14 +311,14 @@ func (controller *userQuizController) Answer(c *gin.Context) {
|
|||||||
|
|
||||||
isCorrect := cmp.Equal(quiz.Answer.String(), userAnswer.String())
|
isCorrect := cmp.Equal(quiz.Answer.String(), userAnswer.String())
|
||||||
var score float32 = 0.0
|
var score float32 = 0.0
|
||||||
var correction string = "wrong"
|
var correction string = "fail"
|
||||||
if isCorrect {
|
if isCorrect {
|
||||||
score = 1.0
|
score = 1.0
|
||||||
correction = "correct"
|
correction = "success"
|
||||||
}
|
}
|
||||||
|
|
||||||
userquiz.Answer = userAnswer
|
userquiz.Answer = userAnswer
|
||||||
userquiz.Status = "answer"
|
userquiz.Status = "done"
|
||||||
userquiz.Result = correction
|
userquiz.Result = correction
|
||||||
userquiz.Score = score
|
userquiz.Score = score
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user