Phase 33: technician climate control and locker assignment.

This commit is contained in:
Leonid Pershin
2026-08-20 04:44:41 +03:00
parent ee23fb4994
commit ce772cd3c3
19 changed files with 436 additions and 24 deletions
+24 -1
View File
@@ -45,13 +45,36 @@ public static class PlaceClimate
}
var offset = 8f;
ClimatePresetDef? climate = null;
if (school.ClimatePresetId is { } presetId
&& catalog.ClimatePresets.TryGetValue(presetId, out var preset)
&& !preset.Abstract)
{
offset = preset.IndoorOffset;
climate = preset;
}
return outdoor + offset;
var indoor = outdoor + offset;
if (HasTechnician(school) && climate is not null)
{
var min = climate.ComfortC - climate.ComfortHalfWidthC;
var max = climate.ComfortC + climate.ComfortHalfWidthC;
if (indoor < min)
{
return min;
}
if (indoor > max)
{
return max;
}
}
return indoor;
}
public static bool HasTechnician(School school) =>
school.Roster?.People.Any(person =>
person.IsStaff && person.Position is { } position
&& position.Equals("Technician", StringComparison.Ordinal)) == true;
}
+5
View File
@@ -367,6 +367,11 @@ public sealed class School : IDisposable
foreach (var date in YearlyIntake.DatesBetween(before, after))
{
Roster = YearlyIntake.Apply(Catalog, Roster, PeopleSeed, CountryId, date, NativeLanguage);
if (Map is not null)
{
Roster = LockerAssigner.Apply(Catalog, Map, Roster);
}
changed = true;
}