feat: add CSV import for student event rankings
Let advisors load preference ranks from a converted CSV with fuzzy matching, known aliases, and a parse-preview-save page instead of relying on the ranking editor. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using Core.Entities;
|
||||
using Core.Models;
|
||||
|
||||
namespace Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Parses student event ranking CSV data against existing students and events.
|
||||
/// </summary>
|
||||
public interface IStudentEventRankingImportService
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses ranking CSV from a stream. The stream is not disposed.
|
||||
/// </summary>
|
||||
StudentEventRankingParseResult Parse(Stream stream, ICollection<Student> students, ICollection<EventDefinition> events);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Core.Entities;
|
||||
using Core.Models;
|
||||
using Core.Parsers;
|
||||
|
||||
namespace Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Wraps <see cref="StudentEventRankingParser"/> for stream-based import.
|
||||
/// </summary>
|
||||
public class StudentEventRankingImportService : IStudentEventRankingImportService
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public StudentEventRankingParseResult Parse(Stream stream, ICollection<Student> students, ICollection<EventDefinition> events)
|
||||
{
|
||||
var reader = new StreamReader(stream, leaveOpen: true);
|
||||
using var parser = new StudentEventRankingParser(reader);
|
||||
return parser.Parse(students, events);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user