feat: add optional student nickname for informal display

Keep legal first and last names for formal lists; show DisplayFirstName on teams, calendars, and import matching so two Josiahs can be told apart.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-12 00:06:33 -04:00
co-authored by Cursor
parent c03ffc0833
commit 29101e2ead
35 changed files with 516 additions and 41 deletions
+16 -4
View File
@@ -17,6 +17,10 @@ public class Student : IEquatable<Student>
[Display(Name = "Last Name")]
public string LastName { get; set; } = null!;
[StringLength(50)]
[Display(Name = "Nickname")]
public string? Nickname { get; set; }
[Range(5,12)]
[Display(Name = "Grade")]
public int Grade { get; set; }
@@ -55,6 +59,17 @@ public class Student : IEquatable<Student>
public string FirstNameLastName => $"{FirstName} {LastName}";
/// <summary>
/// Nickname when set, otherwise <see cref="FirstName"/>.
/// </summary>
public string DisplayFirstName =>
string.IsNullOrWhiteSpace(Nickname) ? FirstName : Nickname.Trim();
public void NormalizeNickname()
{
Nickname = string.IsNullOrWhiteSpace(Nickname) ? null : Nickname.Trim();
}
public static Tuple<string, string> ParseNameParts(string fullName)
{
var match = Match(fullName, @"(.*),\s*(.*)");
@@ -67,10 +82,7 @@ public class Student : IEquatable<Student>
: new Tuple<string, string>(fullName, string.Empty);
}
public override string ToString()
{
return FirstName;
}
public override string ToString() => DisplayFirstName;
public bool VotingDelegate => OfficerRole is Entities.OfficerRole.President or Entities.OfficerRole.VicePresident;