exam.go 551 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package models
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. )
  6. type Exam struct {
  7. Meta
  8. Name string
  9. Participant *Participant
  10. Quizzes []*Quiz
  11. }
  12. func (e *Exam) String() string {
  13. return fmt.Sprintf("Exam ID %v with %v quizzes.", e.ID, len(e.Quizzes))
  14. }
  15. func (e *Exam) GetID() string {
  16. return e.ID
  17. }
  18. func (e *Exam) SetID(id string) {
  19. e.ID = id
  20. }
  21. func (e *Exam) GetHash() string {
  22. return ""
  23. }
  24. func (e *Exam) Marshal() ([]byte, error) {
  25. return json.Marshal(e)
  26. }
  27. func (e *Exam) Unmarshal(data []byte) error {
  28. return json.Unmarshal(data, e)
  29. }