probo/models/exam.go

38 lines
531 B
Go
Raw Normal View History

2023-10-18 13:40:21 +02:00
package models
2023-10-28 20:50:06 +02:00
import (
2023-11-28 16:19:49 +01:00
"encoding/json"
"fmt"
2023-10-28 20:50:06 +02:00
)
2023-10-18 13:40:21 +02:00
type Exam struct {
2023-11-28 16:19:49 +01:00
Meta
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
}
2023-10-28 20:50:06 +02:00
2023-11-28 16:19:49 +01:00
func (e *Exam) SetID(id string) {
e.ID = id
}
2023-10-28 20:50:06 +02:00
2023-11-28 16:19:49 +01:00
func (e *Exam) GetHash() string {
return ""
}
2023-10-18 13:40:21 +02:00
2023-11-28 16:19:49 +01:00
func (e *Exam) Marshal() ([]byte, error) {
return json.Marshal(e)
}
2023-10-18 13:40:21 +02:00
2023-11-28 16:19:49 +01:00
func (e *Exam) Unmarshal(data []byte) error {
return json.Unmarshal(data, e)
2023-10-18 13:40:21 +02:00
}