feat: add test mode to quizzes and withhold its solutions
- mode, navigation and max_attempts columns with Go-side defaults - classes.Withheld gates every solution field of the answer feedback and the attempt result while a test attempt is open - a test's quiz detail lists no questions before the attempt starts - admin fields and lang keys for the three settings
This commit is contained in:
@@ -258,6 +258,10 @@ type Feedback struct {
|
||||
Question models.Question
|
||||
Result ScoreResult
|
||||
CorrectAnswerIDs []uint
|
||||
// Withheld is set for an open test attempt: the solutions stay hidden
|
||||
// and the serializer must drop Result, CorrectAnswerIDs and every
|
||||
// solution field of Question.
|
||||
Withheld bool
|
||||
}
|
||||
|
||||
// Answer records or overwrites the user's answer to one question of an
|
||||
@@ -334,7 +338,7 @@ func (s *Service) Answer(ctx context.Context, userID, attemptID uint, in AnswerI
|
||||
}).Create(&row).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
fb = &Feedback{Question: question, Result: res, CorrectAnswerIDs: correct}
|
||||
fb = &Feedback{Question: question, Result: res, CorrectAnswerIDs: correct, Withheld: Withheld(attempt)}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user