Refactor event occurrence parsing to unify section header handling and event count tracking

This commit updates the EventOccurrenceParseResult and EventOccurrenceParserResult classes to consolidate the handling of skipped section headers and event counts into a single set of properties. The previous separate lists and counts for middle school and high school sections have been replaced with a unified approach, improving clarity and maintainability. Additionally, the EventOccurrenceParserService has been modified to reflect these changes, ensuring consistent behavior across the application. This refactor enhances the overall structure of the event parsing logic.
This commit is contained in:
2026-01-10 18:19:16 -05:00
parent b7e812bb63
commit ecd6173a44
11 changed files with 528 additions and 472 deletions
+6 -8
View File
@@ -14,10 +14,8 @@ public class EventOccurrenceParserResult
{
public IDictionary<EventDefinition, List<Entities.EventOccurrence>> Occurrences { get; set; } = new Dictionary<EventDefinition, List<Entities.EventOccurrence>>();
public List<ParsingIssue> Issues { get; set; } = new();
public List<string> SkippedHSSectionHeaders { get; set; } = new();
public List<string> SkippedMSSectionHeaders { get; set; } = new();
public int SkippedMSEventCount { get; set; }
public int SkippedHSEventCount { get; set; }
public List<string> SkippedSectionHeaders { get; set; } = new();
public int SkippedEventCount { get; set; }
/// <summary>
/// Footnotes captured for each event definition. Footnotes are lines that start with "*" or are parenthetical notes.
/// Multiple footnotes are concatenated into a single string.
@@ -329,12 +327,12 @@ public class EventOccurrenceParser
// School level is set - filter based on it
if (_schoolLevel.Value == SchoolLevel.MiddleSchool && sectionSchoolLevel.Value == SchoolLevel.HighSchool)
{
result.SkippedHSSectionHeaders.Add(normalizedLine);
result.SkippedSectionHeaders.Add(normalizedLine);
return true;
}
if (_schoolLevel.Value == SchoolLevel.HighSchool && sectionSchoolLevel.Value == SchoolLevel.MiddleSchool)
{
result.SkippedMSSectionHeaders.Add(normalizedLine);
result.SkippedSectionHeaders.Add(normalizedLine);
return true;
}
@@ -379,12 +377,12 @@ public class EventOccurrenceParser
// School level is set - filter based on it
if (_schoolLevel.Value == SchoolLevel.MiddleSchool && currentSectionLevel.Value == SchoolLevel.HighSchool)
{
result.SkippedHSEventCount++;
result.SkippedEventCount++;
return true;
}
if (_schoolLevel.Value == SchoolLevel.HighSchool && currentSectionLevel.Value == SchoolLevel.MiddleSchool)
{
result.SkippedMSEventCount++;
result.SkippedEventCount++;
return true;
}