Documentation
¶
Overview ¶
Package preplancalc holds the pure room-capacity math of the SEB/EXaHM pre-planning: which rooms cover a slot's seat demand for a kind (honouring per-exam room restrictions), how many seats a room set provides, which rooms still need to be booked, and the per-program clashes within a slot. All functions are I/O-free over graph/model types and the RoomCapacity value; the DB access and orchestration stay in the plexams package.
Index ¶
- func ApplyBooking(need *model.PreplanKindNeed, bookedSeats int, rooms []RoomCapacity, ...)
- func KindNeed(exams []*model.PreplanExam, kind string, rooms []RoomCapacity) *model.PreplanKindNeed
- func NormRoomName(s string) string
- func ProgramConflicts(exams []*model.PreplanExam) []*model.PreplanProgramConflict
- func RoomsToBook(rooms []RoomCapacity, gap int, booked map[string]bool) []string
- func TotalSeats(rooms []RoomCapacity) int
- type RoomCapacity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyBooking ¶
func ApplyBooking(need *model.PreplanKindNeed, bookedSeats int, rooms []RoomCapacity, bookedRooms map[string]bool)
ApplyBooking fills the booked seats and the still-to-book rooms for one kind.
func KindNeed ¶
func KindNeed(exams []*model.PreplanExam, kind string, rooms []RoomCapacity) *model.PreplanKindNeed
KindNeed sums the seat demand of the pre-exams of one kind in a slot and greedily picks rooms (largest first) to cover it, honouring per-exam room restrictions.
func NormRoomName ¶
NormRoomName upper-cases a room name and strips spaces, so "t 3.014" and "T3.014" compare equal.
func ProgramConflicts ¶
func ProgramConflicts(exams []*model.PreplanExam) []*model.PreplanProgramConflict
ProgramConflicts finds study programs that appear in more than one pre-exam of the same slot (a possible student clash, since Primuss conflicts aren't known yet). Pairs that are explicitly declared "may run at the same time" (CanShareSlot, e.g. parallel sections of the same module) are NOT counted against each other, so a program is only reported when it has a genuinely un-allowed pair in the slot.
func RoomsToBook ¶
func RoomsToBook(rooms []RoomCapacity, gap int, booked map[string]bool) []string
RoomsToBook greedily picks rooms (largest first) that are NOT yet booked for the slot, enough to cover the still-missing seats (gap). Empty when nothing is missing.
func TotalSeats ¶
func TotalSeats(rooms []RoomCapacity) int
TotalSeats sums the seats of the given rooms.
Types ¶
type RoomCapacity ¶
RoomCapacity is one room usable for a given kind, with its seat count.
func RoomsForKind ¶
func RoomsForKind(exams []*model.PreplanExam, kind string, rooms []RoomCapacity) []RoomCapacity
RoomsForKind restricts the candidate rooms by the per-exam allowedRooms of the slot's exams of that kind: only when every such exam restricts its rooms is the pool narrowed to the union of their allowedRooms (an exam without a restriction may use any room, so the full set is kept).