Documentation
¶
Overview ¶
Package conflictcalc holds the pure schedule-conflict math: normalising an ancode pair into a stable key, ranking a conflict's proximity (how close in time two of a student's exams ended up), the proximity of two placed slots, and diffing a freshly generated conflict list against the saved one. All functions are I/O-free over graph/model types; the DB access and aggregation stay in the plexams package.
Index ¶
Constants ¶
const ( SameSlot = "SAME_SLOT" Adjacent = "ADJACENT" SameDay = "SAME_DAY" NextDay = "NEXT_DAY" )
Proximity labels, worst (closest in time) to mildest. Two exams closer than NextDay count as a conflict; NextDay and farther are acceptable.
Variables ¶
This section is empty.
Functions ¶
func DiffAgainstSaved ¶
func DiffAgainstSaved(generated, saved []*model.ExamScheduleConflict) []*model.ExamScheduleConflict
DiffAgainstSaved tags each generated conflict with its status relative to the saved-plan conflicts — "new", "worse", "better" or "unchanged" — and returns the resolved ones (present in the saved plan, gone in the generated one), tagged "resolved". Both lists are keyed on the ancode pair (Ancode1 < Ancode2). The generated conflicts are mutated in place (DiffStatus set).
func NormPair ¶
NormPair returns the two ancodes in ascending order. Ratings, decisions and canShareSlot are stored order-independently, so this is the canonical pair key.
func ProximityRank ¶
ProximityRank orders a proximity label from worst (SAME_SLOT) to mildest, so two plans' conflicts can be compared ("got worse / better") and a conflict list sorted worst-first. Unknown/empty labels rank 0.
Types ¶
This section is empty.