Update EventOccurrence parsing to use EventOccurrenceParseGroup for improved data structure

This commit refactors the EventOccurrence parsing logic to utilize the EventOccurrenceParseGroup class, enhancing the organization of parsed occurrences by grouping them based on event definitions and optional section levels. The changes include updates to the EventOccurrenceParseResult, EventOccurrenceParser, and EventOccurrenceParserService to accommodate the new grouping structure. Additionally, tests are modified to reflect these changes, ensuring that the parsing functionality remains intact and accurate. This refactor improves data handling and aligns with the overall architecture of the application.
This commit is contained in:
2026-04-04 21:55:44 -04:00
parent 4dcd9e5aab
commit f400813667
39 changed files with 1896 additions and 93 deletions
@@ -0,0 +1,42 @@
using GoogleSheetsScheduleImport;
namespace Tests.GoogleSheets;
[TestFixture]
public class ScheduleGridExtractorTests
{
[Test]
public void Extract_SingleBlock_OneOccurrenceWithEndTimeFromNextSlot()
{
string?[][] values =
[
[null, "Main Hall"],
["9:00 a.m.", "Opening Ceremony"],
["10:00 a.m.", null]
];
string?[][] bg =
[
[null, null],
[null, null],
[null, null]
];
var grid = new GridSheetModel
{
SheetTitle = "Day1",
Values = values,
BackgroundKeys = bg
};
var warnings = new List<string>();
var lines = ScheduleGridExtractor.Extract(grid, "April", 2, warnings);
Assert.Multiple(() =>
{
Assert.That(lines, Has.Count.EqualTo(1));
Assert.That(lines[0].Name, Is.EqualTo("Opening Ceremony"));
Assert.That(lines[0].Month, Is.EqualTo("April"));
Assert.That(lines[0].Day, Is.EqualTo(2));
Assert.That(lines[0].Location, Is.EqualTo("Main Hall"));
Assert.That(lines[0].TimeRange, Is.EqualTo("9 a.m. - 10 a.m."));
});
}
}