db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

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) AddAdditionalExam deprecated

func (db *DB) AddAdditionalExam(ctx context.Context, exam model.AdditionalExamInput) (bool, error)

Deprecated: rm me

func (*DB) AddAncode

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

func (*DB) AddExamToSlot

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

func (*DB) AddExternalExam

func (db *DB) AddExternalExam(ctx context.Context, exam *model.ExternalExam) error

func (*DB) AddInvigilation

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

func (*DB) AddNta

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

func (*DB) AddRoomToExam

func (db *DB) AddRoomToExam(ctx context.Context, room *model.RoomForExam) error

func (*DB) AddZpaExamToPlan

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

func (*DB) AdditionalExams deprecated

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

Deprecated: rm me

func (*DB) AllSemesterNames

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

func (*DB) AncodesInPlan

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

func (*DB) BackupPlan

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

func (*DB) CacheExam

func (db *DB) CacheExam(ctx context.Context, exam *model.Exam) error

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) CachedExam

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

func (*DB) CachedExams

func (db *DB) CachedExams(ctx context.Context) ([]*model.Exam, 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) ChangeRoom

func (db *DB) ChangeRoom(ctx context.Context, ancode int, oldRoom, newRoom *model.Room) (bool, error)

func (*DB) CheckStudentRegsCount

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

func (*DB) DropAndSave

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

func (*DB) Exahm

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

func (*DB) ExamGroup

func (db *DB) ExamGroup(ctx context.Context, examGroupCode int) (*model.ExamGroup, error)

func (*DB) ExamGroupIsLocked deprecated

func (db *DB) ExamGroupIsLocked(ctx context.Context, examGroupCode int) bool

Deprecated: rm me

func (*DB) ExamGroups

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

func (*DB) ExamIsLocked

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

func (*DB) ExamWithRegs

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

func (*DB) ExamerInPlan

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

func (*DB) ExamsAlreadyPrepared

func (db *DB) ExamsAlreadyPrepared(ctx context.Context) bool

func (*DB) ExamsInPlan

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

func (*DB) ExamsInSlot deprecated

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

Deprecated: rm me

func (*DB) ExamsWithRegs

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

func (*DB) ExcludeDays

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

func (*DB) ExternalExams

func (db *DB) ExternalExams(ctx context.Context) ([]*model.ExternalExam, 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) GetAncodesPlannedPerProgram

func (db *DB) GetAncodesPlannedPerProgram(ctx context.Context) (map[int][]string, 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) GetExamGroupForAncode

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

func (*DB) GetExamsInSlot

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

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) GetNextExamGroupCode

func (db *DB) GetNextExamGroupCode(ctx context.Context) (int, error)

func (*DB) GetOtherInvigilations

func (db *DB) GetOtherInvigilations(ctx context.Context) ([]*model.Invigilation, 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) 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) GetStudentRegsPerAncodePlanned

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

func (*DB) GetTeacher

func (db *DB) GetTeacher(ctx context.Context, id int) (*model.Teacher, 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) 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) InvigilationsForInvigilator

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

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) Log

func (db *DB) Log(ctx context.Context, subj, msg string) error

func (*DB) MucDaiExamsForProgram

func (db *DB) MucDaiExamsForProgram(ctx context.Context, program string) ([]*MucDaiExam, 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) NtaWithRegs

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

// Deprecated: remove me

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) PlacesWithSockets

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

func (*DB) PlanAncodeEntries deprecated

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

Deprecated: rm me

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) PlanEntryForExamGroup deprecated

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

Deprecated: rm me

func (*DB) PlannedAncodes

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

func (*DB) PlannedExamsByMainExamer deprecated

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

Deprecated: rm me

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) PossibleDays

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

func (*DB) PrimussExamExists

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

func (*DB) RemoveStudentReg

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

func (*DB) RemoveUnlockedExamGroupsFromPlan

func (db *DB) RemoveUnlockedExamGroupsFromPlan(ctx context.Context) (int, error)

func (*DB) ReplaceConnectedExam

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

func (*DB) ReplaceNonNTARooms

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

func (*DB) ReplaceRoomsForNTA

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

func (*DB) RmCacheExams

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

func (*DB) RmExamGroupFromSlot

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

func (*DB) RmZpaExamFromPlan

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

func (*DB) RoomFromName

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

func (*DB) RoomPlannedInSlot

func (db *DB) RoomPlannedInSlot(ctx context.Context, roomName string, day int, time int) ([]*model.RoomForExam, error)

func (*DB) Rooms

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

func (*DB) RoomsForAncode

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

func (*DB) RoomsForSlot

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

func (*DB) RoomsPlannedInSlot

func (db *DB) RoomsPlannedInSlot(ctx context.Context, day, time int) ([]*model.RoomForExam, 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) 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) SaveExamGroups

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

func (*DB) SaveExamsWithRegs

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

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) SaveRooms

func (db *DB) SaveRooms(ctx context.Context, slotsWithRooms []*model.SlotWithRooms) error

func (*DB) SaveSemesterConfig

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

func (*DB) SaveSemesterNTAs

func (db *DB) SaveSemesterNTAs(ctx context.Context, ntaWithRegs []*model.NTAWithRegs) error

// Deprecated: remove me

func (*DB) SaveStudentRegs

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

func (*DB) SaveStudentRegsPerAncode deprecated

func (db *DB) SaveStudentRegsPerAncode(ctx context.Context, studentRegsPerAncode map[int]map[string][]*model.StudentReg, all bool) error

Deprecated: rm me part of generated exams

func (*DB) SaveStudentRegsPerStudent deprecated

func (db *DB) SaveStudentRegsPerStudent(ctx context.Context, studentRegsPerStudent map[string][]*model.StudentReg, all bool) error

Deprecated: rm me

func (*DB) SetCurrentSemesterOnNTA

func (db *DB) SetCurrentSemesterOnNTA(ctx context.Context, mtknr string) error

TODO: when to call?

func (*DB) SetRegsWithErrors

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

func (*DB) SetSemester

func (db *DB) SetSemester(semester string) error

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, ntas map[string]*model.NTA) (*model.Student, error)

func (*DB) StudentRegsForProgram

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

func (*DB) StudentRegsPerStudentAll

func (db *DB) StudentRegsPerStudentAll(ctx context.Context) ([]*model.StudentRegsPerStudent, 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) UnlockExam

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

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"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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