Add meeting schedule state management services and related models
This commit introduces several new services and models to manage the meeting schedule state within localStorage. The MeetingScheduleState class is created to track scheduled teams, absent students, time slot counts, extended teams, and excluded students. Additionally, the IMeetingScheduleStateService interface and its implementation, MeetingScheduleStateService, are added to handle loading and saving state data. The MeetingScheduleClipboardService and MeetingScheduleDataService are also introduced to facilitate clipboard operations and data loading from the database, respectively. These enhancements improve the overall functionality and user experience of the meeting scheduling feature.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using Core.Entities;
|
||||
|
||||
namespace Core.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for filtering teams based on various criteria.
|
||||
/// </summary>
|
||||
public static class TeamFilterExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds teams that are regional events to the collection.
|
||||
/// </summary>
|
||||
public static IEnumerable<Team> AddRegionals(this IEnumerable<Team> currentTeams, IEnumerable<Team> allTeams)
|
||||
{
|
||||
return allTeams.Where(e => e.Event.RegionalEvent).Concat(currentTeams).Distinct();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds teams with high level of effort (>= 3) to the collection.
|
||||
/// </summary>
|
||||
public static IEnumerable<Team> AddHighLevelOfEffort(this IEnumerable<Team> currentTeams, IEnumerable<Team> allTeams)
|
||||
{
|
||||
return allTeams.Where(e => e.Event.LevelOfEffort >= 3).Concat(currentTeams).Distinct();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes individual event teams from the collection.
|
||||
/// </summary>
|
||||
public static IEnumerable<Team> RemoveIndividual(this IEnumerable<Team> teams)
|
||||
{
|
||||
return teams.Where(t => t.Event.EventFormat != EventFormat.Individual);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes teams with low level of effort (<= 1) from the collection.
|
||||
/// </summary>
|
||||
public static IEnumerable<Team> RemoveLowLevelOfEffort(this IEnumerable<Team> teams)
|
||||
{
|
||||
return teams.Where(t => t.Event.LevelOfEffort > 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inverts the selection - returns all teams not in the current selection.
|
||||
/// </summary>
|
||||
public static IEnumerable<Team> Invert(this IEnumerable<Team> currentTeams, IEnumerable<Team> allTeams)
|
||||
{
|
||||
var currentTeamIds = currentTeams.Select(t => t.Id).ToHashSet();
|
||||
return allTeams.Where(t => !currentTeamIds.Contains(t.Id));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user