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:
@@ -110,10 +110,8 @@ public class EventOccurrenceParserService : IEventOccurrenceParserService
|
||||
result.Issues.AddRange(parserResult.Issues);
|
||||
|
||||
// Copy skipped section headers from parser result
|
||||
result.SkippedHSSectionHeaders.AddRange(parserResult.SkippedHSSectionHeaders);
|
||||
result.SkippedMSSectionHeaders.AddRange(parserResult.SkippedMSSectionHeaders);
|
||||
result.SkippedMSEventCount = parserResult.SkippedMSEventCount;
|
||||
result.SkippedHSEventCount = parserResult.SkippedHSEventCount;
|
||||
result.SkippedSectionHeaders.AddRange(parserResult.SkippedSectionHeaders);
|
||||
result.SkippedEventCount = parserResult.SkippedEventCount;
|
||||
|
||||
// Copy footnotes from parser result
|
||||
foreach (var kvp in parserResult.Footnotes)
|
||||
@@ -121,14 +119,10 @@ public class EventOccurrenceParserService : IEventOccurrenceParserService
|
||||
result.Footnotes[kvp.Key] = kvp.Value;
|
||||
}
|
||||
|
||||
// Add informational messages about skipped events
|
||||
if (parserResult.SkippedMSEventCount > 0)
|
||||
// Add informational message about skipped events
|
||||
if (parserResult.SkippedEventCount > 0)
|
||||
{
|
||||
result.Warnings.Add($"Skipped {parserResult.SkippedMSEventCount} Middle School (MS) event occurrence(s) based on school level setting");
|
||||
}
|
||||
if (parserResult.SkippedHSEventCount > 0)
|
||||
{
|
||||
result.Warnings.Add($"Skipped {parserResult.SkippedHSEventCount} High School (HS) event occurrence(s) based on school level setting");
|
||||
result.Warnings.Add($"Skipped {parserResult.SkippedEventCount} event occurrence(s) from other school level based on school level setting");
|
||||
}
|
||||
|
||||
// Validate locations and add warnings for problematic ones
|
||||
|
||||
Reference in New Issue
Block a user