fixed ETA/ETD sorting by taking agency values into account

This commit is contained in:
Daniel Schick 2023-11-10 11:46:43 +01:00
parent d439b7ed12
commit f0fa9285af
2 changed files with 24 additions and 2 deletions

View File

@ -534,8 +534,8 @@ namespace BreCalClient
{
if (x.Shipcall == null) return 0;
if (y.Shipcall == null) return 0;
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta ?? DateTime.Now : x.Shipcall.Etd ?? DateTime.Now;
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta ?? DateTime.Now : y.Shipcall.Etd ?? DateTime.Now;
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now;
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Eta ?? DateTime.Now : y.Etd ?? DateTime.Now;
return DateTime.Compare(xDate, yDate);
});
break;

View File

@ -52,6 +52,28 @@ namespace BreCalClient
public List<Times> Times { get; set; } = new();
public DateTime? Eta
{
get
{
Times? agencyTimes = this.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
if((agencyTimes != null) && (agencyTimes.EtaBerth != null))
return agencyTimes.EtaBerth;
return Shipcall?.Eta;
}
}
public DateTime? Etd
{
get
{
Times? agencyTimes = this.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
if ((agencyTimes != null) && (agencyTimes.EtdBerth != null))
return agencyTimes.EtdBerth;
return Shipcall?.Etd;
}
}
public TrafficLightMode LightMode
{
get