Store leftover CSV columns on hidden student notes, move catalog import to /events/import, and persist Students index columns from Chapter Settings. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
2.0 KiB
C#
74 lines
2.0 KiB
C#
namespace Core.Services;
|
|
|
|
/// <summary>
|
|
/// Implementation of INoteNamingService that provides note naming conventions.
|
|
/// Uses "#" as the prefix for page notes and meeting notes.
|
|
/// </summary>
|
|
public class NoteNamingService : INoteNamingService
|
|
{
|
|
private const string PageNotePrefix = "#";
|
|
private const string MeetingNotePrefix = "#Meeting Notes";
|
|
private const string StudentNotePrefix = "#Student:";
|
|
|
|
/// <inheritdoc/>
|
|
public string GetMeetingNoteTitle(DateTime meetingDate)
|
|
{
|
|
return $"{MeetingNotePrefix} {meetingDate:MM/dd/yyyy}";
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public string GetPageNoteTitle(string pageIdentifier)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(pageIdentifier))
|
|
{
|
|
throw new ArgumentException("Page identifier cannot be null or empty", nameof(pageIdentifier));
|
|
}
|
|
|
|
return $"{PageNotePrefix}{pageIdentifier}";
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public bool IsPageNote(string noteTitle)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(noteTitle))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return noteTitle.StartsWith(PageNotePrefix, StringComparison.Ordinal);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public bool IsMeetingNote(string noteTitle)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(noteTitle))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return noteTitle.StartsWith(MeetingNotePrefix, StringComparison.Ordinal);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public string GetStudentNoteTitle(int studentId) => $"{StudentNotePrefix}{studentId}";
|
|
|
|
/// <inheritdoc/>
|
|
public bool IsStudentNote(string? noteTitle)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(noteTitle))
|
|
return false;
|
|
|
|
return noteTitle.StartsWith(StudentNotePrefix, StringComparison.Ordinal);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public bool TryParseStudentNoteId(string? noteTitle, out int studentId)
|
|
{
|
|
studentId = 0;
|
|
if (!IsStudentNote(noteTitle))
|
|
return false;
|
|
|
|
return int.TryParse(noteTitle.AsSpan(StudentNotePrefix.Length), out studentId);
|
|
}
|
|
}
|