Enhance school simulation and management by integrating roster functionality, allowing for the installation and persistence of student and staff data. Update the school architecture to include a roster alongside existing components, ensuring proper validation against map layouts. Revise room definitions to support homeroom designations and update related tests to validate new functionalities and ensure robustness in roster handling.
This commit is contained in:
@@ -5,8 +5,8 @@ public readonly record struct StaffOpening(string RoomId, string Position);
|
||||
public readonly record struct PupilSeat(string ClassId, string RoomId, int Year, string Letter);
|
||||
|
||||
/// <summary>
|
||||
/// How many pupils and staff a map asks for. Classrooms are rooms with pupil slots; each one
|
||||
/// becomes a roster class. Positions come from <see cref="RoomDef.Positions"/>, not the wire labels.
|
||||
/// How many pupils and staff a map asks for. Homeroom rooms with pupil slots become roster
|
||||
/// classes; every <see cref="RoomDef.Positions"/> entry is a staff opening.
|
||||
/// </summary>
|
||||
public sealed class SchoolDemand
|
||||
{
|
||||
@@ -34,17 +34,17 @@ public sealed class SchoolDemand
|
||||
foreach (var room in map.Rooms)
|
||||
{
|
||||
var slots = PupilSlotsOf(catalog, room);
|
||||
if (slots > 0)
|
||||
{
|
||||
classrooms.Add((room, slots));
|
||||
}
|
||||
|
||||
if (catalog.Rooms.TryGetValue(room.Def, out var def))
|
||||
{
|
||||
foreach (var position in def.Positions)
|
||||
{
|
||||
staff.Add(new StaffOpening(room.Id, position));
|
||||
}
|
||||
|
||||
if (slots > 0 && def.Homeroom)
|
||||
{
|
||||
classrooms.Add((room, slots));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user