Enhance school simulation management by introducing a new SchoolWeekDays option, allowing configuration of the number of working days in a week. Update the API to include school week days in responses and enhance documentation to reflect these changes. Revise UI components to support the new management features, ensuring a seamless user experience when hiring and assigning staff. Update localization strings for improved clarity and consistency across the application.
ci / server (push) Failing after 3m37s
ci / client (push) Successful in 13s

This commit is contained in:
Leonid Pershin
2026-08-19 00:47:09 +03:00
parent 94842ab192
commit 2ebc783585
38 changed files with 1837 additions and 208 deletions
+43 -4
View File
@@ -180,7 +180,9 @@ internal sealed record StaffingResponse(
float Remaining,
IReadOnlyList<UncoveredSubjectResponse> Uncovered,
IReadOnlyList<ApplicantResponse> Applicants,
IReadOnlyList<StaffMemberResponse> Staff);
IReadOnlyList<StaffMemberResponse> Staff,
IReadOnlyList<DefLabelResponse> Positions,
IReadOnlyList<UncoveredSubjectResponse> Subjects);
internal sealed record UncoveredSubjectResponse(
string DefName,
@@ -196,7 +198,8 @@ internal sealed record ApplicantResponse(
int Age,
bool IsParent,
float HourlyWageAsk,
float MonthlyBase);
float MonthlyBase,
IReadOnlyList<LabeledStatResponse> Skills);
internal sealed record StaffMemberResponse(
string Id,
@@ -245,7 +248,8 @@ internal static class StaffingMapper
applicant.Person.AgeOn(asOf),
applicant.Person.IsParent,
applicant.HourlyWageAsk,
rules is null ? 0f : Staffing.MonthlyBase(rules, applicant.HourlyWageAsk)))
rules is null ? 0f : Staffing.MonthlyBase(rules, applicant.HourlyWageAsk),
StrongSkills(applicant.Person, catalog, locale)))
.ToArray();
var staff = roster.People
@@ -255,7 +259,42 @@ internal static class StaffingMapper
.Select(person => Member(person, catalog, rules, locale, asOf))
.ToArray();
return new StaffingResponse(allocated, payroll, remaining, uncovered, applicants, staff);
var positions = catalog is null
? Array.Empty<DefLabelResponse>()
: catalog.Positions.Values
.Where(def => !def.Abstract)
.Select(def => new DefLabelResponse(def.DefName, catalog.Label(locale, def)))
.OrderBy(row => row.Label, StringComparer.Ordinal)
.ToArray();
var subjects = catalog is null
? Array.Empty<UncoveredSubjectResponse>()
: catalog.Subjects.Values
.Where(def => !def.Abstract)
.Select(def => new UncoveredSubjectResponse(
def.DefName,
catalog.Label(locale, def),
def.Grades.Min,
def.Grades.Max,
def.HoursPerWeek))
.ToArray();
return new StaffingResponse(allocated, payroll, remaining, uncovered, applicants, staff, positions, subjects);
}
private static IReadOnlyList<LabeledStatResponse> StrongSkills(Person person, DefCatalog? catalog, string locale)
{
return person.Skills
.OrderByDescending(pair => pair.Value)
.ThenBy(pair => pair.Key, StringComparer.Ordinal)
.Take(3)
.Select(pair => new LabeledStatResponse(
pair.Key,
catalog is not null && catalog.Skills.TryGetValue(pair.Key, out var def)
? catalog.Label(locale, def)
: pair.Key,
pair.Value.ToString()))
.ToArray();
}
private static StaffMemberResponse Member(