When a UTM schedule PDF is parsed, Inforario automatically scans every class session for time overlaps and marks conflicting pairs before the data ever reaches the viewer. This happens in two places: once immediately after parsing (viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DavidCevallos15/inforario-IA-null/llms.txt
Use this file to discover all available pages before exploring further.
resolveConflicts in sguRegexParser.ts) and again reactively inside the dashboard (via the useConflictResolver hook) whenever the sessions array changes.
What Counts as a Conflict
TwoClassSession entries are considered conflicting when they share the same day and their time intervals overlap. The overlap condition uses the standard interval intersection test:
isVirtual: true) and sessions missing a day, startTime, or endTime are excluded from the check entirely — they are collected in a separate bucket and returned with conflict: false.
resolveConflicts (Post-Parse Utility)
resolveConflicts is called in sguRegexParser.ts immediately after all sessions have been extracted from the PDF, before the ParseResult is returned to useScheduleUpload.
conflict field in-place on the cloned session objects and then returns the schedulable sessions (sorted) followed by the unscheduled ones.
useConflictResolver Hook
Inside the dashboard,useConflictResolver re-runs conflict detection reactively using useMemo. The hook is designed to be lightweight: it recalculates only when the sessions reference changes and delegates the core overlap logic to detectOverlap from timeSelectors.ts.
useConflictResolver clones each session object before setting conflict: true, so the original Schedule state managed by App.tsx is never mutated directly.detectOverlap and timeToMins
ThedetectOverlap function in timeSelectors.ts is the single source of truth for the overlap condition used by the hook:
timeToMins converts a "HH:MM" string to an integer number of minutes since midnight, making arithmetic comparisons straightforward and avoiding any date-object overhead.
Visual Indicators
Conflicting sessions are styled distinctly in both views so they are immediately noticeable:ScheduleGrid
A pulsing
AlertTriangle icon appears in the top-right corner of the session card. The card’s background switches to the error container color (!bg-error-container/85) and a red ring is applied (!ring-2 !ring-error/20). In the exported PDF, conflict cells are rendered in rgb(255, 0, 110) regardless of the subject’s assigned color.ScheduleList
A bold CHOQUE badge (error variant) appears next to the time range. The card’s left border color is overridden to the error color instead of the subject’s assigned color.
Exclusion of Virtual Sessions
Sessions without aday, startTime, or endTime are excluded from conflict evaluation in both resolveConflicts and useConflictResolver. Because virtual sessions are pushed to the parser with day: undefined and no time fields, they naturally end up in the unscheduled bucket in both paths.
useConflictResolver additionally applies an explicit !s.isVirtual guard before the comparison loop, while resolveConflicts relies on the missing day/time fields to achieve the same result:
Conflict detection is non-destructive — conflicted sessions are never removed from the schedule. Both overlapping sessions remain fully visible and functional; only their
conflict: boolean flag is set to true and the visual style changes. You can still export, save, and share a schedule that contains conflicts.Conflict Detection Summary
When does conflict detection run?
When does conflict detection run?
Conflict detection runs at two distinct moments:
- At parse time —
resolveConflicts()is called at the end ofparsePDF()andparseRawText()insidesguRegexParser.ts, before theParseResultis returned touseScheduleUpload. - Reactively in the dashboard —
useConflictResolver(sessions)recalculates viauseMemowhenever the sessions array reference changes, such as after a color change or title update that produces a newScheduleobject.
Algorithm complexity
Algorithm complexity
The conflict check uses a nested O(n²) loop over the schedulable sessions. For a typical UTM student schedule (5–8 subjects, 10–20 sessions), this is negligible. Sessions are pre-sorted by day and start time to ensure predictable flagging order.