fix: 晚点车次在原发车时间后不显示

This commit is contained in:
denglihong2007
2025-09-26 23:49:32 +08:00
parent 05569a077d
commit 1f14a4ef79
2 changed files with 4 additions and 4 deletions

View File

@@ -124,13 +124,13 @@ namespace CRSim.ScreenSimulator.ViewModels
var now = TimeService.GetDateTimeNow();
var today = now.Date;
if (_settings.LoadTodayOnly && today.Add((trainNumber.DepartureTime??trainNumber.ArrivalTime)!.Value) < now)
if (_settings.LoadTodayOnly && today.Add((trainNumber.DepartureTime??trainNumber.ArrivalTime)!.Value).Add(trainNumber.Status.Value) < now)
{
continue;
}
DateTime? AdjustTime(TimeSpan? time) =>
time.HasValue ? (today.Add(time.Value) > now ? today.Add(time.Value) : today.Add(time.Value).AddDays(1)) : null;
time.HasValue ? (today.Add(time.Value).Add(trainNumber.Status.Value) > now ? today.Add(time.Value) : today.Add(time.Value).AddDays(1)) : null;
TrainInfo.Add(new TrainInfo
{

View File

@@ -53,12 +53,12 @@ namespace CRSim.ScreenSimulator.ViewModels
{
var now = TimeService.GetDateTimeNow();
var today = now.Date;
if (_settings.LoadTodayOnly && today.Add((trainNumber.DepartureTime ?? trainNumber.ArrivalTime)!.Value) < now)
if (_settings.LoadTodayOnly && today.Add((trainNumber.DepartureTime ?? trainNumber.ArrivalTime)!.Value).Add(trainNumber.Status.Value) < now)
{
continue;
}
DateTime? AdjustTime(TimeSpan? time) =>
time.HasValue ? (today.Add(time.Value) > now ? today.Add(time.Value) : today.Add(time.Value).AddDays(1)) : null;
time.HasValue ? (today.Add(time.Value).Add(trainNumber.Status.Value) > now ? today.Add(time.Value) : today.Add(time.Value).AddDays(1)) : null;
TrainInfos.Add(new TrainInfo
{