- 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
16 lines
662 B
Go
16 lines
662 B
Go
package classes
|
|
|
|
import "git.golem15.com/golem15/sm-quizzes-plugin/models"
|
|
|
|
// IsTest reports whether the quiz runs as a test. A zero or unknown mode is
|
|
// learning, so a quiz written before test mode existed keeps its behaviour.
|
|
func IsTest(q *models.Quiz) bool { return q != nil && q.Mode == models.ModeTest }
|
|
|
|
// Withheld reports whether an attempt's solutions must stay hidden: it is
|
|
// an attempt at a test that is not finished yet. Every student serializer
|
|
// drops is_correct, points, correct answers, explanations and model answers
|
|
// while it is true.
|
|
func Withheld(a *models.Attempt) bool {
|
|
return a != nil && IsTest(a.Quiz) && a.CompletedAt == nil
|
|
}
|