db

package
v1.141.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: BSD-3-Clause Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionName

type CollectionName string

type Conflict

type Conflict struct {
	AnCode     int
	Module     string
	MainExamer string
	Conflicts  map[int]int
}

type ConnectedExam

type ConnectedExam struct {
	ZpaExam           int            `bson:"zpaExamAncode"`
	PrimussExams      []*PrimussExam `bson:"primussExamsAncodes"`
	OtherPrimussExams []*PrimussExam `bson:"otherPrimussExamsAncodes"`
	Errors            []string       `bson:"errors"`
}

type Count

type Count struct {
	AnCode int `bson:"AnCo"`
	Sum    int `bson:"Sum"`
}

type DB

type DB struct {
	Client *mongo.Client
	// contains filtered or unexported fields
}

func NewDB

func NewDB(uri, semester string, dbName *string) (*DB, error)

func (*DB) AddAncode

func (db *DB) AddAncode(ctx context.Context, zpaAncode int, program string, primussAncode int) error

func (*DB) AddConstraints added in v1.20.0

func (db *DB) AddConstraints(ctx context.Context, ancode int, constraints *model.Constraints) (*model.Constraints, error)

func (*DB) AddExamToSlot

func (db *DB) AddExamToSlot(ctx context.Context, planEntry *model.PlanEntry) (bool, error)

func (*DB) AddInvigilation

func (db *DB) AddInvigilation(ctx context.Context, room string, day, slot, invigilatorID int) error

func (*DB) AddNonZpaExam added in v1.3.0

func (db *DB) AddNonZpaExam(ctx context.Context, exam *model.ZPAExam) error

func (*DB) AddNta

func (db *DB) AddNta(ctx context.Context, nta *model.NTA) (*model.NTA, error)

func (*DB) AddNtaRoomAloneWaiver added in v1.131.0

func (db *DB) AddNtaRoomAloneWaiver(ctx context.Context, waiver *model.NtaRoomAloneWaiver) error

AddNtaRoomAloneWaiver stores (or replaces) a waiver (key: mtknr/ancode).

func (*DB) AddPrePlannedInvigilation added in v1.84.0

func (db *DB) AddPrePlannedInvigilation(ctx context.Context, prePlannedInvigilation *model.PrePlannedInvigilation) (bool, error)

func (*DB) AddPrePlannedRoomToExam added in v1.33.0

func (db *DB) AddPrePlannedRoomToExam(ctx context.Context, prePlannedRoom *model.PrePlannedRoom) (bool, error)

func (*DB) AddRoom added in v1.113.0

func (db *DB) AddRoom(ctx context.Context, room *model.Room) (*model.Room, error)

AddRoom inserts a new room and returns it.

func (*DB) AddRoomRequest added in v1.117.0

func (db *DB) AddRoomRequest(ctx context.Context, request *model.RoomRequest) error

AddRoomRequest inserts a single room request.

func (*DB) AddStudentReg added in v1.36.0

func (db *DB) AddStudentReg(ctx context.Context, program string, ancode int, mtknr string) error

func (*DB) AddZpaExamToPlan

func (db *DB) AddZpaExamToPlan(ctx context.Context, ancode int) (bool, error)

func (*DB) AllAnnyBookings added in v1.77.0

func (db *DB) AllAnnyBookings(ctx context.Context) ([]*model.AnnyBooking, error)

func (*DB) AllSemesterNames

func (db *DB) AllSemesterNames() ([]*model.Semester, error)

func (*DB) AncodesInPlan

func (db *DB) AncodesInPlan(ctx context.Context) ([]int, error)

func (*DB) AnnyBookings added in v1.77.0

func (db *DB) AnnyBookings(ctx context.Context, room *string) ([]*model.AnnyBooking, error)

func (*DB) AnnyBookingsCollection added in v1.77.0

func (db *DB) AnnyBookingsCollection(ctx context.Context) *mongo.Collection

func (*DB) BackupPlan

func (db *DB) BackupPlan(ctx context.Context) error

func (*DB) BlockRoomForSlot added in v1.119.0

func (db *DB) BlockRoomForSlot(ctx context.Context, block *model.BlockedRoom) error

BlockRoomForSlot stores (or updates) a room-slot block (key: room/day/slot).

func (*DB) BlockedRooms added in v1.119.0

func (db *DB) BlockedRooms(ctx context.Context) ([]*model.BlockedRoom, error)

BlockedRooms returns all room-slot blocks of the semester, sorted by room/day/slot.

func (*DB) CacheGeneratedExams

func (db *DB) CacheGeneratedExams(ctx context.Context, exams []*model.GeneratedExam) error

func (*DB) CacheInvigilatorTodos

func (db *DB) CacheInvigilatorTodos(ctx context.Context, todos *model.InvigilationTodos) error

func (*DB) CacheTeachers

func (db *DB) CacheTeachers(teachers []*model.Teacher, semester string) error

func (*DB) CacheZPAExams

func (db *DB) CacheZPAExams(exams []*model.ZPAExam) error

func (*DB) ChangeAncode

func (db *DB) ChangeAncode(ctx context.Context, program string, ancode, newAncode int) (*model.PrimussExam, error)

func (*DB) ChangeAncodeInConflicts

func (db *DB) ChangeAncodeInConflicts(ctx context.Context, program string, ancode, newAncode int) (*model.Conflicts, error)

func (*DB) ChangeAncodeInStudentRegs

func (db *DB) ChangeAncodeInStudentRegs(ctx context.Context, program string, ancode, newAncode int) ([]*model.StudentReg, error)

func (*DB) ChangeAncodeInStudentRegsCount

func (db *DB) ChangeAncodeInStudentRegsCount(ctx context.Context, program string, ancode, newAncode int) error

func (*DB) CheckStudentRegsCount

func (db *DB) CheckStudentRegsCount(ctx context.Context, program string, ancode, studentRegsCount int) bool

func (*DB) ClearEmailAttachments added in v1.102.0

func (db *DB) ClearEmailAttachments(ctx context.Context, kind string) (int, error)

ClearEmailAttachments deletes all attachments of a kind and returns how many were removed.

func (*DB) DeleteInvigilatorConstraints added in v1.139.0

func (db *DB) DeleteInvigilatorConstraints(ctx context.Context, teacherID int) (bool, error)

DeleteInvigilatorConstraints removes the constraints record of one invigilator. Returns false if there was none.

func (*DB) DeletePermanentNonInvigilator added in v1.140.0

func (db *DB) DeletePermanentNonInvigilator(ctx context.Context, teacherID int) (bool, error)

DeletePermanentNonInvigilator removes one permanent non-invigilator. Returns false if there was none.

func (*DB) DropAndSave

func (db *DB) DropAndSave(ctx context.Context, objects []interface{}) error

func (*DB) EmailAttachmentInfos added in v1.102.0

func (db *DB) EmailAttachmentInfos(ctx context.Context, kind string) ([]*EmailAttachment, error)

EmailAttachmentInfos returns the attachments of a kind WITHOUT their binary data (for listing in the GUI), sorted by key.

func (*DB) Exahm

func (db *DB) Exahm(ctx context.Context, ancode int) (bool, error)

func (*DB) ExamIsLocked

func (db *DB) ExamIsLocked(ctx context.Context, ancode int) bool

func (*DB) ExamerInPlan

func (db *DB) ExamerInPlan(ctx context.Context) ([]*model.ExamerInPlan, error)

func (*DB) ExamsInSlot

func (db *DB) ExamsInSlot(ctx context.Context, day int, time int) ([]*model.PlannedExam, error)

func (*DB) ExcludeDays

func (db *DB) ExcludeDays(ctx context.Context, ancode int, days []*time.Time) (bool, error)

func (*DB) GetAddedAncodes

func (db *DB) GetAddedAncodes(ctx context.Context) (map[int][]model.ZPAPrimussAncodes, error)

func (*DB) GetAddedAncodesForAncode

func (db *DB) GetAddedAncodesForAncode(ctx context.Context, ancode int) ([]model.ZPAPrimussAncodes, error)

func (*DB) GetAllInvigilations

func (db *DB) GetAllInvigilations(ctx context.Context) ([]*model.Invigilation, error)

func (*DB) GetConnectedExam

func (db *DB) GetConnectedExam(ctx context.Context, ancode int) (*model.ConnectedExam, error)

func (*DB) GetConnectedExams

func (db *DB) GetConnectedExams(ctx context.Context) ([]*model.ConnectedExam, error)

func (*DB) GetConstraints

func (db *DB) GetConstraints(ctx context.Context) ([]*model.Constraints, error)

func (*DB) GetConstraintsForAncode

func (db *DB) GetConstraintsForAncode(ctx context.Context, ancode int) (*model.Constraints, error)

func (*DB) GetEmailAttachment added in v1.102.0

func (db *DB) GetEmailAttachment(ctx context.Context, kind, key string) (*EmailAttachment, error)

GetEmailAttachment returns one attachment incl. its data, or nil if not found.

func (*DB) GetGeneratedExam

func (db *DB) GetGeneratedExam(ctx context.Context, ancode int) (*model.GeneratedExam, error)

func (*DB) GetGeneratedExams

func (db *DB) GetGeneratedExams(ctx context.Context) ([]*model.GeneratedExam, error)

func (*DB) GetGeneratedExamsForExamer

func (db *DB) GetGeneratedExamsForExamer(ctx context.Context, examerID int) ([]*model.GeneratedExam, error)

func (*DB) GetInvigilationInSlot

func (db *DB) GetInvigilationInSlot(ctx context.Context, roomname string, day, slot int) ([]*model.Invigilation, error)

func (*DB) GetInvigilationTodos

func (db *DB) GetInvigilationTodos(ctx context.Context) (*model.InvigilationTodos, error)

func (*DB) GetInvigilatorForRoom

func (db *DB) GetInvigilatorForRoom(ctx context.Context, name string, day, time int) (*model.Teacher, error)

func (*DB) GetInvigilatorInSlot

func (db *DB) GetInvigilatorInSlot(ctx context.Context, roomname string, day, slot int) (*model.Teacher, error)

func (*DB) GetInvigilatorRequirements

func (db *DB) GetInvigilatorRequirements(ctx context.Context, teacherID int) (*zpa.SupervisorRequirements, error)

func (*DB) GetInvigilators

func (db *DB) GetInvigilators(ctx context.Context) ([]*model.Teacher, error)

func (*DB) GetOtherInvigilations

func (db *DB) GetOtherInvigilations(ctx context.Context) ([]*model.Invigilation, error)

func (*DB) GetPlanEntriesInSlot added in v1.23.0

func (db *DB) GetPlanEntriesInSlot(ctx context.Context, day int, time int) ([]*model.PlanEntry, error)

func (*DB) GetPrimussConflictsForAncode

func (db *DB) GetPrimussConflictsForAncode(ctx context.Context, program string, ancode int) (*model.Conflicts, error)

func (*DB) GetPrimussConflictsForAncodeOnlyPlanned

func (db *DB) GetPrimussConflictsForAncodeOnlyPlanned(ctx context.Context, program string, ancode int, zpaExamsToPlan []*model.ZPAExam) (*model.Conflicts, error)

func (*DB) GetPrimussExam

func (db *DB) GetPrimussExam(ctx context.Context, program string, ancode int) (*model.PrimussExam, error)

func (*DB) GetPrimussExams

func (db *DB) GetPrimussExams(ctx context.Context) ([]*model.PrimussExamByProgram, error)

func (*DB) GetPrimussExamsForAncode

func (db *DB) GetPrimussExamsForAncode(ctx context.Context, ancode int) ([]*model.PrimussExam, error)

func (*DB) GetPrimussStudentRegsForProgrammAncode

func (db *DB) GetPrimussStudentRegsForProgrammAncode(ctx context.Context, program string, ancode int) ([]*model.StudentReg, error)

func (*DB) GetPrimussStudentRegsPerAncode

func (db *DB) GetPrimussStudentRegsPerAncode(ctx context.Context, program string) (map[int][]*model.StudentReg, error)

func (*DB) GetPrimussStudentRegsPerStudent

func (db *DB) GetPrimussStudentRegsPerStudent(ctx context.Context, program string) (map[string][]*model.StudentReg, error)

func (*DB) GetPrograms

func (db *DB) GetPrograms(ctx context.Context) ([]string, error)

func (*DB) GetRegsWithErrors

func (db *DB) GetRegsWithErrors(ctx context.Context) ([]*model.RegWithError, error)

func (*DB) GetRoomRequest added in v1.115.0

func (db *DB) GetRoomRequest(ctx context.Context, room string, day, slot int) (*model.RoomRequest, error)

GetRoomRequest returns one room request (key: room/day/slot) or nil.

func (*DB) GetSelfInvigilations

func (db *DB) GetSelfInvigilations(ctx context.Context) ([]*model.Invigilation, error)

func (*DB) GetStudentRegsCount

func (db *DB) GetStudentRegsCount(ctx context.Context, program string, ancode int) (int, error)

func (*DB) GetTeacher

func (db *DB) GetTeacher(ctx context.Context, id int) (*model.Teacher, error)

func (*DB) GetTeacherIdByRegex added in v1.39.0

func (db *DB) GetTeacherIdByRegex(ctx context.Context, name string) (int, error)

func (*DB) GetTeachers

func (db *DB) GetTeachers(ctx context.Context) ([]*model.Teacher, error)

func (*DB) GetZPAExams

func (db *DB) GetZPAExams(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAExamsNotToPlan

func (db *DB) GetZPAExamsNotToPlan(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAExamsPlannedOrNotPlanned

func (db *DB) GetZPAExamsPlannedOrNotPlanned(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAExamsToPlan

func (db *DB) GetZPAExamsToPlan(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) GetZPAStudentByMtknr added in v1.61.0

func (db *DB) GetZPAStudentByMtknr(ctx context.Context, mtknr string) (*model.ZPAStudent, error)

func (*DB) GetZPAStudents added in v1.62.0

func (db *DB) GetZPAStudents(ctx context.Context) ([]*model.ZPAStudent, error)

func (*DB) GetZpaAncodesNotPlanned

func (db *DB) GetZpaAncodesNotPlanned(ctx context.Context) (*set.Set[int], error)

func (*DB) GetZpaAncodesPlanned

func (db *DB) GetZpaAncodesPlanned(ctx context.Context) (*set.Set[int], error)

func (*DB) GetZpaAncodesPlannedOrNotPlanned

func (db *DB) GetZpaAncodesPlannedOrNotPlanned(ctx context.Context) (*set.Set[int], error)

func (*DB) GetZpaExamByAncode

func (db *DB) GetZpaExamByAncode(ctx context.Context, ancode int) (*model.ZPAExam, error)

func (*DB) HasRoom added in v1.113.0

func (db *DB) HasRoom(ctx context.Context, name string) (bool, error)

HasRoom reports whether a room with the given name exists.

func (*DB) InvigilationsForInvigilator

func (db *DB) InvigilationsForInvigilator(ctx context.Context, invigilatorID int) ([]*model.Invigilation, error)

func (*DB) InvigilatorConstraints added in v1.139.0

func (db *DB) InvigilatorConstraints(ctx context.Context) ([]*model.InvigilatorConstraints, error)

InvigilatorConstraints returns all per-invigilator constraints stored in the DB (managed via the GUI), separate from the ZPA-sourced requirements.

func (*DB) InvigilatorConstraintsForTeacher added in v1.139.0

func (db *DB) InvigilatorConstraintsForTeacher(ctx context.Context, teacherID int) (*model.InvigilatorConstraints, error)

InvigilatorConstraintsForTeacher returns the constraints of one invigilator, or nil if none are stored.

func (*DB) Lab

func (db *DB) Lab(ctx context.Context, ancode int) (bool, error)

func (*DB) LockExam

func (db *DB) LockExam(ctx context.Context, ancode int) (*model.PlanEntry, error)

func (*DB) LockPlan

func (db *DB) LockPlan(ctx context.Context) error

func (*DB) MucDaiExam added in v1.3.0

func (db *DB) MucDaiExam(ctx context.Context, program string, ancode int) (*MucDaiExam, error)

func (*DB) MucDaiExamsForProgram

func (db *DB) MucDaiExamsForProgram(ctx context.Context, program string) ([]*MucDaiExam, error)

func (*DB) NonZpaExam added in v1.3.0

func (db *DB) NonZpaExam(ctx context.Context, ancode int) (*model.ZPAExam, error)

func (*DB) NonZpaExams added in v1.3.0

func (db *DB) NonZpaExams(ctx context.Context) ([]*model.ZPAExam, error)

func (*DB) NotPlannedByMe

func (db *DB) NotPlannedByMe(ctx context.Context, ancode int) (bool, error)

func (*DB) Nta

func (db *DB) Nta(ctx context.Context, mtknr string) (*model.NTA, error)

func (*DB) NtaRoomAloneWaivers added in v1.131.0

func (db *DB) NtaRoomAloneWaivers(ctx context.Context) ([]*model.NtaRoomAloneWaiver, error)

NtaRoomAloneWaivers returns all accepted NTA room-alone waivers of the semester, sorted by mtknr/ancode.

func (*DB) NtaWithRegs

func (db *DB) NtaWithRegs(ctx context.Context, mtknr string) (*model.NTAWithRegs, error)

func (*DB) Ntas

func (db *DB) Ntas(ctx context.Context) ([]*model.NTA, error)

func (*DB) NtasWithRegs

func (db *DB) NtasWithRegs(ctx context.Context) ([]*model.Student, error)

func (*DB) Online

func (db *DB) Online(ctx context.Context, ancode int) (bool, error)

func (*DB) PermanentNonInvigilators added in v1.140.0

func (db *DB) PermanentNonInvigilators(ctx context.Context) ([]*model.PermanentNonInvigilator, error)

PermanentNonInvigilators returns the teachers who never do invigilation duty again. This list lives in the global "plexams" database and carries over between semesters.

func (*DB) PlacesWithSockets

func (db *DB) PlacesWithSockets(ctx context.Context, ancode int) (bool, error)

func (*DB) PlanEntries

func (db *DB) PlanEntries(ctx context.Context) ([]*model.PlanEntry, error)

func (*DB) PlanEntry

func (db *DB) PlanEntry(ctx context.Context, ancode int) (*model.PlanEntry, error)

func (*DB) PlannedAncodes

func (db *DB) PlannedAncodes(ctx context.Context) ([]*model.PlanEntry, error)

func (*DB) PlannedRoomNames

func (db *DB) PlannedRoomNames(ctx context.Context) ([]string, error)

func (*DB) PlannedRoomNamesInSlot

func (db *DB) PlannedRoomNamesInSlot(ctx context.Context, day, slot int) ([]string, error)

func (*DB) PlannedRooms

func (db *DB) PlannedRooms(ctx context.Context) ([]*model.PlannedRoom, error)

func (*DB) PlannedRoomsForAncode

func (db *DB) PlannedRoomsForAncode(ctx context.Context, ancode int) ([]*model.PlannedRoom, error)

func (*DB) PlannedRoomsInSlot

func (db *DB) PlannedRoomsInSlot(ctx context.Context, day, slot int) ([]*model.PlannedRoom, error)

func (*DB) PlanningConditionsSet added in v1.121.0

func (db *DB) PlanningConditionsSet(ctx context.Context) ([]string, error)

PlanningConditionsSet returns the keys of all conditions that are currently set (done) for the semester.

func (*DB) PossibleDays

func (db *DB) PossibleDays(ctx context.Context, ancode int, days []*time.Time) (bool, error)

func (*DB) PrePlannedInvigilations added in v1.84.0

func (db *DB) PrePlannedInvigilations(ctx context.Context) ([]*model.PrePlannedInvigilation, error)

func (*DB) PrePlannedInvigilationsForInvigilator added in v1.84.0

func (db *DB) PrePlannedInvigilationsForInvigilator(ctx context.Context, invigilatorID int) ([]*model.PrePlannedInvigilation, error)

func (*DB) PrePlannedRooms added in v1.33.0

func (db *DB) PrePlannedRooms(ctx context.Context) ([]*model.PrePlannedRoom, error)

func (*DB) PrePlannedRoomsForExam added in v1.50.0

func (db *DB) PrePlannedRoomsForExam(ctx context.Context, ancode int) ([]*model.PrePlannedRoom, error)

func (*DB) PrimussExamExists

func (db *DB) PrimussExamExists(ctx context.Context, program string, ancode int) (bool, error)

func (*DB) RemoveNtaRoomAloneWaiver added in v1.131.0

func (db *DB) RemoveNtaRoomAloneWaiver(ctx context.Context, mtknr string, ancode int) (bool, error)

RemoveNtaRoomAloneWaiver deletes a waiver (key: mtknr/ancode). It reports whether a document was removed.

func (*DB) RemovePrePlannedInvigilation added in v1.125.0

func (db *DB) RemovePrePlannedInvigilation(ctx context.Context, day, slot int, roomName *string) (bool, error)

RemovePrePlannedInvigilation deletes a pre-planned invigilation (key: day/slot/roomName; roomName nil = the reserve). It reports whether a document was actually removed.

func (*DB) RemovePrePlannedRoomFromExam added in v1.119.0

func (db *DB) RemovePrePlannedRoomFromExam(ctx context.Context, ancode int, roomName string, mtknr *string) (bool, error)

RemovePrePlannedRoomFromExam deletes a pre-planned room from an exam (key: ancode/roomName/mtknr). It reports whether a document was actually removed.

func (*DB) RemoveStudentReg

func (db *DB) RemoveStudentReg(ctx context.Context, program string, ancode int, mtknr string) (int, error)

func (*DB) ReplaceAllRoomRequests added in v1.115.0

func (db *DB) ReplaceAllRoomRequests(ctx context.Context, requests []*model.RoomRequest) error

ReplaceAllRoomRequests drops the collection and inserts the given requests.

func (*DB) ReplaceConnectedExam

func (db *DB) ReplaceConnectedExam(ctx context.Context, exam *model.ConnectedExam) error

func (*DB) ReplaceNta added in v1.111.0

func (db *DB) ReplaceNta(ctx context.Context, nta *model.NTA) (*model.NTA, error)

ReplaceNta replaces the NTA document identified by its mtknr. It does not upsert: if no document matches, nothing is changed.

func (*DB) ReplacePlannedRooms added in v1.34.0

func (db *DB) ReplacePlannedRooms(ctx context.Context, plannedRooms []*model.PlannedRoom) error

func (*DB) ReplaceRoom added in v1.113.0

func (db *DB) ReplaceRoom(ctx context.Context, room *model.Room) (*model.Room, error)

ReplaceRoom replaces the room identified by its name (no upsert) and returns it. Errors if no room with that name exists.

func (*DB) ReplaceUnplacedExams added in v1.137.1

func (db *DB) ReplaceUnplacedExams(ctx context.Context, unplaced []*model.UnplacedExam) error

ReplaceUnplacedExams drops and rewrites the rooms_unplaced collection (the students that could not be assigned a real room in their slot during room generation).

func (*DB) ResetGeneratedInvigilations added in v1.126.0

func (db *DB) ResetGeneratedInvigilations(ctx context.Context) error

ResetGeneratedInvigilations drops the generated invigilations (invigilations_other). The pre-planning (invigilations_pre_planned) and the self-invigilations (invigilations_self) are not touched.

func (*DB) ResetPlannedRooms added in v1.126.0

func (db *DB) ResetPlannedRooms(ctx context.Context) error

ResetPlannedRooms drops the generated planned rooms (planned_rooms). The pre-planning (rooms_pre_planned) is not touched.

func (*DB) ResetUnplacedExams added in v1.137.1

func (db *DB) ResetUnplacedExams(ctx context.Context) error

ResetUnplacedExams drops the rooms_unplaced collection.

func (*DB) RmConstraints added in v1.20.0

func (db *DB) RmConstraints(ctx context.Context, ancode int) (bool, error)

func (*DB) RmZpaExamFromPlan

func (db *DB) RmZpaExamFromPlan(ctx context.Context, ancode int) (bool, error)

func (*DB) RoomByName added in v1.33.0

func (db *DB) RoomByName(ctx context.Context, roomName string) (*model.Room, error)

func (*DB) RoomRequests added in v1.115.0

func (db *DB) RoomRequests(ctx context.Context) ([]*model.RoomRequest, error)

RoomRequests returns all building-management room requests of the semester, sorted by room, day, slot.

func (*DB) Rooms

func (db *DB) Rooms(ctx context.Context) ([]*model.Room, error)

func (*DB) RoomsForSlot

func (db *DB) RoomsForSlot(ctx context.Context, day int, time int) (*model.RoomsForSlot, error)

func (*DB) RoomsForSlots added in v1.31.0

func (db *DB) RoomsForSlots(ctx context.Context) ([]*model.RoomsForSlot, error)

func (*DB) SafeExamBrowser

func (db *DB) SafeExamBrowser(ctx context.Context, ancode int) (bool, error)

func (*DB) SameSlot

func (db *DB) SameSlot(ctx context.Context, ancode int, ancodes []int) (bool, error)

func (*DB) Save

func (db *DB) Save(ctx context.Context, objects []interface{}) error

func (*DB) SaveAnnyBookings added in v1.77.0

func (db *DB) SaveAnnyBookings(ctx context.Context, bookings []*model.AnnyBooking) error

func (*DB) SaveConnectedExam

func (db *DB) SaveConnectedExam(ctx context.Context, exam *model.ConnectedExam) error

func (*DB) SaveConnectedExams

func (db *DB) SaveConnectedExams(ctx context.Context, exams []*model.ConnectedExam) error

func (*DB) SaveEmailAttachment added in v1.102.0

func (db *DB) SaveEmailAttachment(ctx context.Context, att *EmailAttachment) error

SaveEmailAttachment stores (upserts) one attachment, keyed by (kind, key).

func (*DB) SavePlanEntries

func (db *DB) SavePlanEntries(ctx context.Context, planEntries []*model.PlanEntry) error

func (*DB) SavePlanEntriesToBackup

func (db *DB) SavePlanEntriesToBackup(ctx context.Context, planEntries []*model.PlanEntry) error

func (*DB) SaveRoomsForSlots added in v1.31.0

func (db *DB) SaveRoomsForSlots(ctx context.Context, roomsForSlots []*model.RoomsForSlot) error

func (*DB) SaveSemesterConfig

func (db *DB) SaveSemesterConfig(ctx context.Context, semesterConfig *model.SemesterConfig) error

func (*DB) SaveStudentRegs

func (db *DB) SaveStudentRegs(ctx context.Context, studentRegs []interface{}) error

func (*DB) SetInvigilationPrePlanned added in v1.85.0

func (db *DB) SetInvigilationPrePlanned(ctx context.Context, day, slot int, roomName *string, prePlanned bool) error

SetInvigilationPrePlanned sets the prePlanned flag on the invigilation for a room (roomName != nil) or the reserve (roomName == nil) in a slot in the invigilations_other collection.

func (*DB) SetNtaDeactivated added in v1.111.0

func (db *DB) SetNtaDeactivated(ctx context.Context, mtknr string, deactivated bool) (*model.NTA, error)

SetNtaDeactivated sets the deactivated flag of the NTA identified by mtknr. Returns nil if no NTA with that mtknr exists.

func (*DB) SetPlanningCondition added in v1.121.0

func (db *DB) SetPlanningCondition(ctx context.Context, key string, set bool) error

SetPlanningCondition marks a condition as done (set=true, upsert) or removes it (set=false).

func (*DB) SetRegsWithErrors

func (db *DB) SetRegsWithErrors(ctx context.Context, regsWithErrors []*model.RegWithError) error

func (*DB) SetRoomDeactivated added in v1.112.0

func (db *DB) SetRoomDeactivated(ctx context.Context, name string, deactivated bool) (*model.Room, error)

SetRoomDeactivated sets the deactivated flag of the room identified by name. Returns an error if no room with that name exists.

func (*DB) SetRoomRequestActive added in v1.115.0

func (db *DB) SetRoomRequestActive(ctx context.Context, room string, day, slot int, active bool) (*model.RoomRequest, error)

SetRoomRequestActive sets the active flag (key: room/day/slot). Returns nil if no such request exists.

func (*DB) SetRoomRequestApproved added in v1.115.0

func (db *DB) SetRoomRequestApproved(ctx context.Context, room string, day, slot int, approved bool) (*model.RoomRequest, error)

SetRoomRequestApproved sets the approved flag (key: room/day/slot). Returns nil if no such request exists.

func (*DB) SetRoomRequestWith added in v1.114.0

func (db *DB) SetRoomRequestWith(ctx context.Context, name, requestWith string, needsRequest bool) error

SetRoomRequestWith sets the requestWith and (derived) needsRequest fields of the room identified by name.

func (*DB) SetSemesterOnNTAs

func (db *DB) SetSemesterOnNTAs(ctx context.Context, studentRegs []interface{}) error

func (*DB) SetZPAExamsToPlan

func (db *DB) SetZPAExamsToPlan(ctx context.Context, examsToPlan, examsNotToPlan []*model.ZPAExam) error

func (*DB) StudentByMtknr

func (db *DB) StudentByMtknr(ctx context.Context, mtknr string) (*model.Student, error)

func (*DB) StudentRegsForProgram

func (db *DB) StudentRegsForProgram(ctx context.Context, program string) ([]*model.StudentReg, error)

func (*DB) StudentRegsPerStudentPlanned

func (db *DB) StudentRegsPerStudentPlanned(ctx context.Context) ([]*model.Student, error)

func (*DB) StudentsByName

func (db *DB) StudentsByName(ctx context.Context, regex string) ([]*model.Student, error)

func (*DB) UnblockRoomForSlot added in v1.119.0

func (db *DB) UnblockRoomForSlot(ctx context.Context, room string, day, slot int) (bool, error)

UnblockRoomForSlot removes a room-slot block (key: room/day/slot). It reports whether a block was actually removed.

func (*DB) UnlockExam

func (db *DB) UnlockExam(ctx context.Context, ancode int) (*model.PlanEntry, error)

func (*DB) UnplacedExams added in v1.137.1

func (db *DB) UnplacedExams(ctx context.Context) ([]*model.UnplacedExam, error)

UnplacedExams returns the students that could not be assigned a real room in their slot during the last room generation.

func (*DB) UpdateRoomRequestTime added in v1.117.0

func (db *DB) UpdateRoomRequestTime(ctx context.Context, room string, day, slot int, from, until time.Time) (*model.RoomRequest, error)

UpdateRoomRequestTime changes the time range of a room request (key: room/day/slot). Returns nil if no such request exists.

func (*DB) UpsertInvigilatorConstraints added in v1.139.0

func (db *DB) UpsertInvigilatorConstraints(ctx context.Context, constraints *model.InvigilatorConstraints) error

UpsertInvigilatorConstraints creates or replaces the whole constraints record of one invigilator (key: teacherID).

func (*DB) UpsertPermanentNonInvigilator added in v1.140.0

func (db *DB) UpsertPermanentNonInvigilator(ctx context.Context, nonInvigilator *model.PermanentNonInvigilator) error

UpsertPermanentNonInvigilator creates or replaces one permanent non-invigilator (key: teacherID).

type EmailAttachment added in v1.102.0

type EmailAttachment struct {
	Kind        string    `bson:"kind"`
	Key         string    `bson:"key"`
	Filename    string    `bson:"filename"`
	ContentType string    `bson:"contentType"`
	Size        int       `bson:"size"`
	Data        []byte    `bson:"data,omitempty"`
	UploadedAt  time.Time `bson:"uploadedAt"`
}

EmailAttachment is a file uploaded by the GUI (or imported by the CLI) to be attached to an individual email later: cover-page PDFs (kind "cover-page", key = teacher ID) and per-invigilator PNGs (kind "invigilation-image", key = invigilator ID). One document per (kind, key); re-uploading replaces it.

type ExamToPlanType

type ExamToPlanType struct {
	Ancode int
	ToPlan bool
}

type MucDaiExam

type MucDaiExam struct {
	PrimussAncode  int    `bson:"Nr"`
	Module         string `bson:"Modulname"`
	ExamType       string `bson:"Prüfungsform"`
	Grading        string `bson:"Bewertung"`
	Duration       int    `bson:"Dauer"`
	MainExamer     string `bson:"Erstpruefender"`
	SecondExamer   string `bson:"Zweitpruefender"`
	IsRepeaterExam string `bson:"IstWiederholung"`
	Program        string `bson:"Studiengruppe"`
	Planer         string `bson:"Prüfungsplanung"`
}

type PrimussExam

type PrimussExam struct {
	Ancode  int    `bson:"ancode"`
	Program string `bson:"program"`
}

type PrimussType

type PrimussType string
const (
	StudentRegs PrimussType = "studentregs"
	Exams       PrimussType = "exams"
	Counts      PrimussType = "count"
	Conflicts   PrimussType = "conflicts"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL