feat: add seating plans for learning groups
This commit is contained in:
@@ -19,6 +19,13 @@ public interface IGroupRepository
|
||||
void Save(LearningGroup group);
|
||||
void Delete(Guid id);
|
||||
}
|
||||
public interface ISeatingPlanRepository
|
||||
{
|
||||
SeatingPlan? GetById(Guid id);
|
||||
List<SeatingPlan> GetByGroup(Guid groupId);
|
||||
void Save(SeatingPlan plan);
|
||||
void Delete(Guid id);
|
||||
}
|
||||
public interface IGroupMembershipRepository
|
||||
{
|
||||
List<GroupMembership> GetByStudent(Guid studentId);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace LehrerApp.Core.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Ein Sitzplan einer Lerngruppe. Eine Gruppe kann mehrere Pläne besitzen,
|
||||
/// beispielsweise für unterschiedliche Unterrichtsräume.
|
||||
/// </summary>
|
||||
public class SeatingPlan
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid GroupId { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
public string Room { get; set; } = "";
|
||||
public int Rows { get; set; } = 4;
|
||||
public int Columns { get; set; } = 4;
|
||||
public List<SeatAssignment> Assignments { get; set; } = [];
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class SeatAssignment
|
||||
{
|
||||
public int Row { get; set; }
|
||||
public int Column { get; set; }
|
||||
public Guid StudentId { get; set; }
|
||||
}
|
||||
@@ -21,7 +21,8 @@ public class PersonalDataExportService(
|
||||
IGradeRepository grades,
|
||||
IExamResultRepository examResults,
|
||||
IParticipationRepository participation,
|
||||
IDocumentationRepository documentation)
|
||||
IDocumentationRepository documentation,
|
||||
ISeatingPlanRepository seatingPlans)
|
||||
{
|
||||
public string ExportAsJson(Guid studentId)
|
||||
{
|
||||
@@ -43,6 +44,18 @@ public class PersonalDataExportService(
|
||||
Klausurergebnisse = examResults.GetByStudent(studentId),
|
||||
Mitarbeit = participation.GetByStudent(studentId),
|
||||
Dokumentation = documentation.GetByStudent(studentId),
|
||||
Sitzplaetze = studentGroups
|
||||
.SelectMany(g => seatingPlans.GetByGroup(g!.Id))
|
||||
.SelectMany(plan => plan.Assignments
|
||||
.Where(a => a.StudentId == studentId)
|
||||
.Select(a => new
|
||||
{
|
||||
Sitzplan = plan.Name,
|
||||
plan.Room,
|
||||
Reihe = a.Row + 1,
|
||||
Platz = a.Column + 1,
|
||||
}))
|
||||
.ToList(),
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(dto, new JsonSerializerOptions
|
||||
|
||||
Reference in New Issue
Block a user