conflictcalc

package
v1.218.0 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: 2 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 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

View Source
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

func NormPair(a, b int) (int, int)

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

func ProximityRank(label string) int

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.

func SlotProximity

func SlotProximity(a, b *model.Slot) (int, string)

SlotProximity returns the proximity rank and label of two placed slots (higher rank = closer in time = worse); rank 0 with an empty label means far enough apart to not count as a conflict.

Types

This section is empty.

Jump to

Keyboard shortcuts

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