Enhance event definitions and parsing logic for new event types
Added new event definitions for "Meet the Candidates", "Chapter Officer Meeting", "Voting Delegate Meeting", and "Social Gathering". Updated the EventOccurrenceParser to handle these new event types and modified related services and views to accommodate the changes. Improved test coverage for the new event definitions and ensured proper parsing and display in the calendar components.
This commit is contained in:
@@ -41,17 +41,26 @@ public class EventOccurrenceParserService : IEventOccurrenceParserService
|
||||
var eventDefinition = kvp.Key;
|
||||
var occurrences = kvp.Value;
|
||||
|
||||
// Check if this is a special event type (GeneralSchedule or VotingDelegates)
|
||||
// Check if this is a special event type (not stored in database)
|
||||
if (eventDefinition == EventDefinition.GeneralSchedule ||
|
||||
eventDefinition == EventDefinition.VotingDelegates)
|
||||
eventDefinition == EventDefinition.MeetTheCandidates ||
|
||||
eventDefinition == EventDefinition.ChapterOfficerMeeting ||
|
||||
eventDefinition == EventDefinition.VotingDelegateMeeting ||
|
||||
eventDefinition == EventDefinition.SocialGathering)
|
||||
{
|
||||
// For special events, set EventDefinitionId to null and set SpecialEventType
|
||||
foreach (var occurrence in occurrences)
|
||||
{
|
||||
occurrence.EventDefinitionId = null;
|
||||
occurrence.SpecialEventType = eventDefinition == EventDefinition.GeneralSchedule
|
||||
? "GeneralSchedule"
|
||||
: "VotingDelegates";
|
||||
occurrence.SpecialEventType = eventDefinition switch
|
||||
{
|
||||
var ed when ed == EventDefinition.GeneralSchedule => "GeneralSchedule",
|
||||
var ed when ed == EventDefinition.MeetTheCandidates => "MeetTheCandidates",
|
||||
var ed when ed == EventDefinition.ChapterOfficerMeeting => "ChapterOfficerMeeting",
|
||||
var ed when ed == EventDefinition.VotingDelegateMeeting => "VotingDelegateMeeting",
|
||||
var ed when ed == EventDefinition.SocialGathering => "SocialGathering",
|
||||
_ => throw new InvalidOperationException($"Unknown special event type: {eventDefinition.Name}")
|
||||
};
|
||||
}
|
||||
|
||||
// Add to result with the special EventDefinition as key
|
||||
|
||||
Reference in New Issue
Block a user