Add student name formatting utilities and refactor team student name handling

This commit introduces two new utility classes: StudentNameFormatter and TeamStudentNameFormatter, which provide methods for formatting student names with options for indicating absence and overlaps. The Team class has been updated to remove the StudentsFirstNames property, and various components across the WebApp have been refactored to utilize the new formatting utilities. This enhances the maintainability and readability of the code while improving the presentation of student names in the UI.
This commit is contained in:
2026-01-11 21:43:00 -05:00
parent 6cd4418142
commit f8c22690d4
13 changed files with 504 additions and 121 deletions
@@ -4,6 +4,7 @@
@using WebApp.Models
@using WebApp.Components.Shared.Components
@using Core.Validation
@using Core.Utility
@inject AppDbContext Context
@inject WebApp.LocalStorageService LocalStorage
@inject ValidationService ValidationService
@@ -83,7 +84,12 @@
@foreach (var team in teamsToDisplay)
{
var isCaptain = team.Captain != null && team.Captain.Equals(context.Item.Student);
var teamMembers = string.Join(", ", team.Students.Select(s => s.FirstName));
var teamMembers = TeamStudentNameFormatter.FormatStudentList(
team,
new TeamStudentNameFormatter.FormatOptions
{
Ordering = TeamStudentNameFormatter.OrderingStyle.None
});
<MudTooltip Text="@teamMembers">
<MudChip Size="Size.Small"