Enhance timetable functionality and UI integration
- Updated protocol documentation to include new `classId` and `roomLabel` fields in the timetable API responses. - Added classes and rooms to the timetable response structure, improving data accessibility for client applications. - Enhanced the UI components to display timetable information, including class and room details, in the management and people panels. - Implemented functionality to fetch and display personal timetables for individuals, ensuring a comprehensive view of schedules. - Revised localization strings to support new timetable features and improve user experience. - Added tests to validate the new timetable functionalities and ensure robustness in handling timetable data.
This commit is contained in:
@@ -70,7 +70,8 @@ internal sealed class GameLoopService(
|
||||
worker.RosterSnapshot,
|
||||
worker.ApplicantSnapshot,
|
||||
worker.CatalogSnapshot,
|
||||
worker.TimetableSnapshot);
|
||||
worker.TimetableSnapshot,
|
||||
worker.MapSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,4 +644,5 @@ internal sealed record PublishedSchoolPeople(
|
||||
Roster? Roster,
|
||||
ApplicantPool? Applicants,
|
||||
DefCatalog? Catalog,
|
||||
Timetable? Timetable);
|
||||
Timetable? Timetable,
|
||||
MapLayout? Map);
|
||||
|
||||
@@ -54,6 +54,7 @@ internal static class PersonCardReader
|
||||
PeopleListMapper.RolesOf(person),
|
||||
year,
|
||||
letter,
|
||||
person.ClassId,
|
||||
person.Position,
|
||||
PeopleListMapper.PositionLabel(catalog, locale, person.Position),
|
||||
Body(person, catalog, locale),
|
||||
|
||||
@@ -46,6 +46,7 @@ internal sealed class SchoolWorker
|
||||
private ApplicantPool? _applicantSnapshot;
|
||||
private DefCatalog? _catalogSnapshot;
|
||||
private Timetable? _timetableSnapshot;
|
||||
private MapLayout? _mapSnapshot;
|
||||
private OccupancyKey _occupancyKey;
|
||||
private School? _school;
|
||||
private Task? _run;
|
||||
@@ -109,6 +110,9 @@ internal sealed class SchoolWorker
|
||||
/// <summary>Last built timetable. Published like the roster — HTTP never reads the live school.</summary>
|
||||
public Timetable? TimetableSnapshot => Volatile.Read(ref _timetableSnapshot);
|
||||
|
||||
/// <summary>Frozen map instance. Safe to read from HTTP with the catalog; it does not mutate.</summary>
|
||||
public MapLayout? MapSnapshot => Volatile.Read(ref _mapSnapshot);
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_run = Task.Factory.StartNew(
|
||||
@@ -205,6 +209,7 @@ internal sealed class SchoolWorker
|
||||
var catalog = _mods.LoadCatalog(packIds, _logger);
|
||||
Volatile.Write(ref _catalogSnapshot, catalog);
|
||||
var map = _mods.LoadMap(packIds, _savedMap);
|
||||
Volatile.Write(ref _mapSnapshot, map);
|
||||
try
|
||||
{
|
||||
MapValidator.Validate(map, catalog);
|
||||
@@ -565,6 +570,7 @@ internal sealed class SchoolWorker
|
||||
Volatile.Write(ref _rosterSnapshot, school.Roster);
|
||||
Volatile.Write(ref _applicantSnapshot, school.Applicants);
|
||||
Volatile.Write(ref _timetableSnapshot, school.Timetable);
|
||||
Volatile.Write(ref _mapSnapshot, school.Map);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user