probo/models/exam.go

38 lines
551 B
Go

package models
import (
"encoding/json"
"fmt"
)
type Exam struct {
Meta
Name string
Participant *Participant
Quizzes []*Quiz
}
func (e *Exam) String() string {
return fmt.Sprintf("Exam ID %v with %v quizzes.", e.ID, len(e.Quizzes))
}
func (e *Exam) GetID() string {
return e.ID
}
func (e *Exam) SetID(id string) {
e.ID = id
}
func (e *Exam) GetHash() string {
return ""
}
func (e *Exam) Marshal() ([]byte, error) {
return json.Marshal(e)
}
func (e *Exam) Unmarshal(data []byte) error {
return json.Unmarshal(data, e)
}