conflictcalc

package
v1.245.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 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 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), classifying two placed exams by their absolute times and durations, 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 (
	Overlap  = "OVERLAP"
	TooClose = "TOO_CLOSE"
	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.

Overlap  – the exams (incl. NTA time) run at the same time, or leave a student less
           than the travel/break buffer (examGapMinutes) between them: impossible.
TooClose – same day, start times closer than notTooCloseMinutes: undesirable.
SameDay  – same day, but far enough apart.
NextDay  – consecutive calendar day.

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 (OVERLAP) 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 TimeProximity added in v1.224.0

func TimeProximity(startA, endA, startB, endB time.Time, examGapMinutes, notTooCloseMinutes int) (int, string)

TimeProximity classifies two of a student's placed exams by their absolute start/end times (end = start + duration incl. NTA), returning a rank (higher = worse) and label. examGapMinutes is the required travel/break buffer between two exams; a smaller gap (including a real overlap) is an OVERLAP. notTooCloseMinutes is the start-to-start distance below which two same-day exams are flagged TOO_CLOSE. Rank 0 / "" 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