From a9f80b8f869fbfd4309e81601fb411793a24cb0d Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 10 Apr 2024 12:04:29 +0200 Subject: [PATCH] Make sorting take agency times as more important into account if they are set --- src/BreCalClient/MainWindow.xaml.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 3c1c64f..3ec35b6 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -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;