Add rain and snow minutes to the morning commute.

Day plans take a precomputed extra; Ai does not know precipitation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 09:40:24 +03:00
co-authored by Cursor
parent fbac890be2
commit ce71a91a67
11 changed files with 189 additions and 16 deletions
+7 -2
View File
@@ -10,6 +10,10 @@ public readonly record struct DayPlan(DateOnly Day, DateTime? AppearAt, DateTime
public bool Comes => AppearAt is not null;
}
/// <summary>
/// Day plans. Rain and snow arrive as already-counted extra minutes — this project does not
/// know precipitation.
/// </summary>
public static class DayPlans
{
public static DayPlan Build(
@@ -20,7 +24,8 @@ public static class DayPlans
Timetable? timetable,
DateTime time,
int weekDays,
int schoolSeed)
int schoolSeed,
int extraCommuteMinutes = 0)
{
ArgumentNullException.ThrowIfNull(catalog);
ArgumentNullException.ThrowIfNull(walks);
@@ -48,7 +53,7 @@ public static class DayPlans
travel = 0f;
}
var slack = SlackMinutes(catalog, person, schoolSeed, day);
var slack = SlackMinutes(catalog, person, schoolSeed, day) + Math.Max(0, extraCommuteMinutes);
var appear = DateTime.SpecifyKind(utc.Date.Add(firstStart.ToTimeSpan()).AddMinutes(-(travel + slack)), DateTimeKind.Utc);
var walkHome = DateTime.SpecifyKind(utc.Date.Add(lastEnd.ToTimeSpan()), DateTimeKind.Utc);
return new DayPlan(day, appear, walkHome, firstRoom);