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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user