ecd6173a44
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.
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using Core.Entities;
|
|
using Heron.MudCalendar;
|
|
|
|
namespace WebApp.Models;
|
|
|
|
/// <summary>
|
|
/// Calendar event item model for Heron.MudCalendar component.
|
|
/// Maps from EventOccurrence entity to calendar event format.
|
|
/// </summary>
|
|
public class CalendarEventItem : CalendarItem
|
|
{
|
|
/// <summary>
|
|
/// Gets the original EventOccurrence data.
|
|
/// </summary>
|
|
public EventOccurrence? EventOccurrenceData { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets the associated EventDefinition if available.
|
|
/// </summary>
|
|
public EventDefinition? EventDefinition { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets the list of student first names from teams matching the EventDefinition.
|
|
/// </summary>
|
|
public List<string> StudentFirstNames { get; set; } = [];
|
|
|
|
/// <summary>
|
|
/// Parameterless constructor required by Heron.MudCalendar component.
|
|
/// </summary>
|
|
public CalendarEventItem()
|
|
{
|
|
// Initialize base class properties to avoid null reference issues
|
|
Text = string.Empty;
|
|
Start = DateTime.MinValue;
|
|
End = DateTime.MinValue;
|
|
}
|
|
|
|
public CalendarEventItem(EventOccurrence occurrence, IEnumerable<string>? studentFirstNames = null)
|
|
{
|
|
EventOccurrenceData = occurrence;
|
|
EventDefinition = occurrence.EventDefinition;
|
|
// Set base class properties that the calendar component uses
|
|
StudentFirstNames = studentFirstNames?.ToList() ?? [];
|
|
Text = occurrence.EventDefinition?.ShortName;
|
|
Start = occurrence.StartTime;
|
|
End = occurrence.EndTime ?? occurrence.StartTime.AddHours(1);
|
|
|
|
}
|
|
}
|