feat: import leftover student fields into notes and show them on the roster
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>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Core.Models;
|
||||
using Core.Notes;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace WebApp.Models;
|
||||
|
||||
@@ -51,4 +53,26 @@ public class ChapterSettings
|
||||
/// School level for the chapter (null = import both MS and HS events)
|
||||
/// </summary>
|
||||
public SchoolLevel? SchoolLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Field names from student note <c>## Imported fields</c> tables to show as Students index columns.
|
||||
/// </summary>
|
||||
public List<string> StudentIndexNoteFields { get; set; } = [.. StudentNoteFieldDefaults.IndexColumns];
|
||||
|
||||
public static ChapterSettings FromConfiguration(IConfiguration configuration)
|
||||
{
|
||||
var settings = configuration.GetSection("ChapterSettings").Get<ChapterSettings>()
|
||||
?? new ChapterSettings();
|
||||
settings.StudentIndexNoteFields = ReadIndexNoteFields(configuration);
|
||||
return settings;
|
||||
}
|
||||
|
||||
public static List<string> ReadIndexNoteFields(IConfiguration configuration)
|
||||
{
|
||||
var fields = configuration.GetSection("ChapterSettings:StudentIndexNoteFields").Get<List<string>>();
|
||||
if (fields is null)
|
||||
return [.. StudentNoteFieldDefaults.IndexColumns];
|
||||
|
||||
return [.. fields.Where(f => !string.IsNullOrWhiteSpace(f)).Select(f => f.Trim())];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user