Make sorting take agency times as more important into account if they are set

This commit is contained in:
Daniel Schick 2024-04-10 12:04:29 +02:00
parent 004908e9c0
commit d25eea2f92

View File

@ -710,7 +710,13 @@ namespace BreCalClient
if (x.Shipcall == null) return 0;
if (y.Shipcall == null) return 0;
DateTime xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now;
Times? xTimes = x.GetTimesForParticipantType(ParticipantType.AGENCY);
if(xTimes != null)
xDate = (x.Shipcall.Type == ShipcallType.Arrival) ? xTimes.EtaBerth ?? DateTime.Now : xTimes.EtdBerth ?? DateTime.Now;
DateTime yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? y.Eta ?? DateTime.Now : y.Etd ?? DateTime.Now;
Times? yTimes = y.GetTimesForParticipantType(ParticipantType.AGENCY);
if (yTimes != null)
yDate = (y.Shipcall.Type == ShipcallType.Arrival) ? yTimes.EtaBerth ?? DateTime.Now : yTimes.EtdBerth ?? DateTime.Now;
return DateTime.Compare(xDate, yDate);
});
break;