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:
+12
-5
@@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using MudBlazor.Services;
|
||||
using Serilog;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using Core.Notes;
|
||||
using VisNetwork.Blazor;
|
||||
using WebApp;
|
||||
using WebApp.Authentication;
|
||||
@@ -34,21 +36,24 @@ if (!File.Exists(dataAppSettingsPath))
|
||||
var baseConfig = File.ReadAllText(baseAppSettingsPath);
|
||||
var baseDoc = JsonDocument.Parse(baseConfig);
|
||||
|
||||
var templateSettings = new Dictionary<string, object?>();
|
||||
JsonObject templateSettings = [];
|
||||
|
||||
if (baseDoc.RootElement.TryGetProperty("ChapterSettings", out var chapterSettings))
|
||||
{
|
||||
templateSettings["ChapterSettings"] = JsonSerializer.Deserialize<object>(chapterSettings.GetRawText());
|
||||
var chapterObj = JsonNode.Parse(chapterSettings.GetRawText()) as JsonObject ?? [];
|
||||
if (chapterObj["StudentIndexNoteFields"] is null)
|
||||
chapterObj["StudentIndexNoteFields"] = JsonSerializer.SerializeToNode(StudentNoteFieldDefaults.IndexColumns);
|
||||
templateSettings["ChapterSettings"] = chapterObj;
|
||||
}
|
||||
|
||||
if (baseDoc.RootElement.TryGetProperty("ValidationSettings", out var validationSettings))
|
||||
{
|
||||
templateSettings["ValidationSettings"] = JsonSerializer.Deserialize<object>(validationSettings.GetRawText());
|
||||
templateSettings["ValidationSettings"] = JsonNode.Parse(validationSettings.GetRawText());
|
||||
}
|
||||
|
||||
if (templateSettings.Any())
|
||||
if (templateSettings.Count > 0)
|
||||
{
|
||||
var json = JsonSerializer.Serialize(templateSettings, new JsonSerializerOptions
|
||||
var json = templateSettings.ToJsonString(new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
});
|
||||
@@ -206,6 +211,8 @@ builder.Services.AddScoped<WebApp.Services.IDatabaseBackupService, WebApp.Servic
|
||||
builder.Services.AddScoped<WebApp.Services.IYearRolloverService, WebApp.Services.YearRolloverService>();
|
||||
builder.Services.AddScoped<Core.Services.IStudentEventRankingImportService, Core.Services.StudentEventRankingImportService>();
|
||||
builder.Services.AddScoped<WebApp.Services.IStudentEventRankingSaveService, WebApp.Services.StudentEventRankingSaveService>();
|
||||
builder.Services.AddScoped<Core.Services.IStudentNotesImportService, Core.Services.StudentNotesImportService>();
|
||||
builder.Services.AddScoped<WebApp.Services.IStudentNotesImportSaveService, WebApp.Services.StudentNotesImportSaveService>();
|
||||
|
||||
builder.Services.Configure<StateScheduleHandoutOptions>(
|
||||
builder.Configuration.GetSection(StateScheduleHandoutOptions.SectionName));
|
||||
|
||||
Reference in New Issue
Block a user