Interview notes can print each student's ranked events and a shared attribute legend from the same catalog as the ranking index, without leftover table markup or collapsed answer space. Co-authored-by: Cursor <cursoragent@cursor.com>
107 lines
4.5 KiB
C#
107 lines
4.5 KiB
C#
using Core.Entities;
|
|
using Core.Printing;
|
|
using MudBlazor;
|
|
|
|
namespace WebApp.Models
|
|
{
|
|
public static class AppIcons
|
|
{
|
|
public static string EventRank = Icons.Material.Filled.AddChart;
|
|
public static string Teams = Icons.Material.Filled.Group;
|
|
public static string Student = Icons.Material.Filled.Person;
|
|
public static string TeamAssignment = Icons.Material.Filled.GroupAdd;
|
|
public static string Events = Icons.Material.Filled.Dashboard;
|
|
public static string Scheduler = Icons.Material.Filled.CalendarMonth;
|
|
public static string Captain = Icons.Material.Filled.Star;
|
|
public static string Registration = Icons.Material.Filled.AppRegistration;
|
|
public static string EventCalendar = Icons.Material.Filled.Event;
|
|
public static string LevelOfEffortIcon(int? loe) =>
|
|
loe switch
|
|
{
|
|
1 => EventAttributeMarks.LevelOfEffort1,
|
|
2 => EventAttributeMarks.LevelOfEffort2,
|
|
3 => EventAttributeMarks.LevelOfEffort3,
|
|
_ => Icons.Material.Filled.QuestionMark
|
|
};
|
|
|
|
public static string OnSiteActivity => EventAttributeMarks.OnSite;
|
|
public static string RegionalEvent => EventAttributeMarks.Regional;
|
|
public static string IndividualEvent => EventAttributeMarks.Individual;
|
|
public static string PresubmissionEvent => EventAttributeMarks.Presubmission;
|
|
public static string PresentationEvent => "";
|
|
|
|
public static IReadOnlyDictionary<string, string> IconTooltips { get; } =
|
|
EventAttributeMarks.LegendItems.ToDictionary(m => m.Symbol, m => m.Label, StringComparer.Ordinal);
|
|
|
|
public static IReadOnlyDictionary<string, string> IconColors { get; } =
|
|
EventAttributeMarks.LegendItems.ToDictionary(m => m.Symbol, m => m.Color, StringComparer.Ordinal);
|
|
|
|
public static string EventEffort(EventDefinition eventDefinition)
|
|
{
|
|
return LevelOfEffortIcon(eventDefinition.LevelOfEffort);
|
|
}
|
|
|
|
public static string EventAttributes(EventDefinition eventDefinition)
|
|
{
|
|
var v = new List<string>();
|
|
|
|
if (eventDefinition.EventFormat == EventFormat.Individual)
|
|
v.Add(IndividualEvent);
|
|
if (eventDefinition.RegionalEvent)
|
|
v.Add(RegionalEvent);
|
|
if (eventDefinition.InterviewOrPresentation)
|
|
v.Add(PresentationEvent);
|
|
if (eventDefinition.Presubmission)
|
|
v.Add(PresubmissionEvent);
|
|
if (eventDefinition.OnSiteActivity)
|
|
v.Add(OnSiteActivity);
|
|
|
|
return string.Join(" ", v);
|
|
}
|
|
|
|
public static string OfficerRoleIcon(OfficerRole officerRole)
|
|
{
|
|
return officerRole switch
|
|
{
|
|
OfficerRole.President => Icons.Material.Filled.Gavel,
|
|
OfficerRole.VicePresident => Icons.Material.Filled.StarBorderPurple500,
|
|
OfficerRole.Secretary => Icons.Material.Filled.Draw,
|
|
OfficerRole.Treasurer => Icons.Material.Filled.Key,
|
|
OfficerRole.Reporter => Icons.Material.Filled.Mic,
|
|
OfficerRole.SergeantAtArms => Icons.Material.Filled.Handshake,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(officerRole), officerRole, null)
|
|
};
|
|
}
|
|
|
|
public static string RankedEventColor(int rank) => EventRankLegend.ColorHex(rank);
|
|
|
|
public static string GetOrdinal(int num) => EventRankLegend.Ordinal(num);
|
|
|
|
public static string GetOrdinalSuperscript(int number)
|
|
{
|
|
var ordinal = EventRankLegend.Ordinal(number);
|
|
var suffixAt = 0;
|
|
while (suffixAt < ordinal.Length && (char.IsDigit(ordinal[suffixAt]) || ordinal[suffixAt] == '-'))
|
|
suffixAt++;
|
|
return suffixAt is 0 || suffixAt == ordinal.Length
|
|
? ordinal
|
|
: $"{ordinal[..suffixAt]}<sup>{ordinal[suffixAt..]}</sup>";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the standard chip variant for student chips (Outlined).
|
|
/// </summary>
|
|
public static Variant StudentChipVariant() => Variant.Outlined;
|
|
|
|
/// <summary>
|
|
/// Returns the standard chip variant for event chips (Filled).
|
|
/// </summary>
|
|
public static Variant EventChipVariant() => Variant.Filled;
|
|
|
|
/// <summary>
|
|
/// Returns the standard chip variant for team chips (Filled).
|
|
/// </summary>
|
|
public static Variant TeamChipVariant() => Variant.Filled;
|
|
}
|
|
}
|