roomcalc

package
v1.218.4 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: BSD-3-Clause Imports: 3 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

Overview

Package roomcalc holds the pure room-seat math of the room preparation: whether a room satisfies an exam's room constraints (EXaHM/SEB/Lab/socket/allowed-rooms feature matching), the required free-seat buffer for an exam, and the free seats an exam currently has across its rooms. All functions are I/O-free over graph/model types; the stateful room allocation and DB access stay in the plexams package.

Index

Constants

View Source
const (
	FreeSeatsMin     = 2
	FreeSeatsPercent = 5
)

FreeSeatsMin / FreeSeatsPercent define the minimum free-seat buffer an exam must keep: at least FreeSeatsMin seats and at least FreeSeatsPercent percent of the normal students, so no exam is packed exactly full.

Variables

This section is empty.

Functions

func ExamFreeSeats

func ExamFreeSeats(roomInfo map[string]*model.Room, examRooms []*model.PlannedRoom, ancode int) (free, normalStudents int)

ExamFreeSeats returns, for one exam, the free seats across its normal rooms (NTA-alone rooms excluded, reserve rooms count as free) and the number of students placed in normal rooms.

func ExamRegsAndNTAs

func ExamRegsAndNTAs(exam *model.PlannedExam) (normalRegs []string, ntasInNormalRooms, ntasInAloneRooms []*model.NTA)

ExamRegsAndNTAs partitions an exam's registrations for the room allocation: the NTAs are split into those needing a room alone and those going into normal rooms; normalRegs holds the Mtknrs of all non-NTA student registrations across the exam's Primuss sections, in section then registration order.

func FreeSeatsBuffer

func FreeSeatsBuffer(normalStudents int) int

FreeSeatsBuffer returns the required free-seat buffer for an exam with the given number of normal (non-NTA) students: max(FreeSeatsMin, ceil(FreeSeatsPercent%)).

func SatisfiesConstraints

func SatisfiesConstraints(room *model.Room, constraints *model.Constraints) bool

SatisfiesConstraints reports whether a room may host an exam with the given room constraints. A room with a special feature (EXaHM / Lab / SEB) is only used for an exam that requires at least one feature the room actually has; never for one that requires none of them. EXaHM and SEB are compatible: an EXaHM room may also host SEB exams (the T-building EXaHM rooms run SEB too). A Lab room only serves Lab exams (or SEB/EXaHM if it has those). An all-false RoomConstraints object (present but nothing required) must not let such a room slip through.

func SortPrePlannedRooms

func SortPrePlannedRooms(rooms []*model.PrePlannedRoom, roomInfo map[string]*model.Room)

SortPrePlannedRooms orders an exam's pre-planned rooms into fill order, in place: NTA rooms (Mtknr != nil) first (keeping their relative input order), then the non-reserve rooms by descending seat count, then the reserve rooms last (keeping their relative input order). roomInfo provides the seat counts for the non-reserve ordering.

Types

This section is empty.

Jump to

Keyboard shortcuts

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