Documentation
¶
Index ¶
- Variables
- func Init()
- func InsertAssignment(a Assignment) error
- func InsertSubject(s Subject) error
- func InsertSubmission(s *Submission) error
- func InsertTeacher(t *Teacher) error
- func InsertUser(u *User) error
- func IsTeacher(username, subjectId string) bool
- func NewSubmissionId() string
- func UpdateSubmission(s *Submission) error
- func UpdateUser(u *User) error
- type Assignment
- type Subject
- type Submission
- func GetActiveSubmissions(subjectId, assignmentId string) []Submission
- func GetAllSubmissions(subjectId, assignmentId string) []Submission
- func GetSubmission(subjectId, assignmentId, id string) (*Submission, error)
- func GetSubmissionOrPanic(subjectId, assignmentId, id string) *Submission
- func GetSubmissionsOfUser(subjectId, assignmentId, ownerUsername string) []Submission
- type Teacher
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("object already exists") ErrNotFound = errors.New("no such object") )
Functions ¶
func InsertAssignment ¶
func InsertAssignment(a Assignment) error
func InsertSubject ¶
func InsertSubmission ¶
func InsertSubmission(s *Submission) error
func InsertTeacher ¶
func InsertUser ¶
func NewSubmissionId ¶
func NewSubmissionId() string
func UpdateSubmission ¶
func UpdateSubmission(s *Submission) error
func UpdateUser ¶
Types ¶
type Assignment ¶
type Assignment struct {
Id string
SubjectId string `bson:"subject_id"`
Name string
Image string
Timeout time.Duration
SubmissionPath string `bson:"submission_path"`
SoftDeadline time.Time `bson:"soft_deadline"`
HardDeadline time.Time `bson:"hard_deadline"`
DailyPenalty int `bson:"daily_penalty"`
MaxScoreByTests int `bson:"max_score_by_tests"`
MaxScoreByTeacher int `bson:"max_score_by_teacher"`
}
Assignment holds data related to an assignment.
func GetAllAssignments ¶
func GetAllAssignments(subjectId string) []Assignment
func GetAssignment ¶
func GetAssignment(subjectId, id string) (*Assignment, error)
func GetAssignmentOrPanic ¶
func GetAssignmentOrPanic(subjectId, id string) *Assignment
type Subject ¶
Subject holds data related to a subject.
func GetAllSubjects ¶
func GetAllSubjects() []Subject
func GetSubject ¶
func GetSubjectOrPanic ¶
type Submission ¶
type Submission struct {
Id string
AssignmentId string `bson:"assignment_id"`
SubjectId string `bson:"subject_id"`
OwnerUsername string `bson:"owner_username"`
Status string // TODO: make this a constant or an enum.
Timestamp time.Time
UploadedFile []byte `bson:"uploaded_file",json:"-"`
UploadedFileName string `bson:"uploaded_file_name",json:"-"`
Logs []byte
Metadata map[string]string
ScoreByTests int `bson:"score_by_tests"`
GradedByTeacher bool `bson:"graded_by_teacher"`
GraderUsername string `bson:"grader_username"`
ScoreByTeacher int `bson:"score_by_teacher"`
Feedback string
}
Submission holds data related to a submission.
func GetActiveSubmissions ¶
func GetActiveSubmissions(subjectId, assignmentId string) []Submission
func GetAllSubmissions ¶
func GetAllSubmissions(subjectId, assignmentId string) []Submission
func GetSubmission ¶
func GetSubmission(subjectId, assignmentId, id string) (*Submission, error)
func GetSubmissionOrPanic ¶
func GetSubmissionOrPanic(subjectId, assignmentId, id string) *Submission
func GetSubmissionsOfUser ¶
func GetSubmissionsOfUser(subjectId, assignmentId, ownerUsername string) []Submission
Click to show internal directories.
Click to hide internal directories.