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 }