Filter shipcalls that have ata set and ata is more than 2 hours in the past
This commit is contained in:
parent
30c8069a9b
commit
c1b4affb20
@ -640,7 +640,7 @@ namespace BreCalClient
|
|||||||
// first add everything
|
// first add everything
|
||||||
this._visibleControlModels.AddRange(_allShipcallsDict.Values);
|
this._visibleControlModels.AddRange(_allShipcallsDict.Values);
|
||||||
|
|
||||||
// now remove elements whose filter criteria are met
|
// now remove elements whose filter criteria are met
|
||||||
|
|
||||||
if(sfm.Berths.Count > 0 )
|
if(sfm.Berths.Count > 0 )
|
||||||
{
|
{
|
||||||
@ -745,7 +745,34 @@ namespace BreCalClient
|
|||||||
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);
|
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(this._sortOrder)
|
// special Basti case: Wenn das ATA / ATD eingetragen ist und schon 2 Stunden in der Vergangenheit liegt
|
||||||
|
if (searchPastDays <= 3)
|
||||||
|
{
|
||||||
|
_ = this._visibleControlModels.RemoveAll(x =>
|
||||||
|
{
|
||||||
|
Times? mooringTimes = x.GetTimesForParticipantType(ParticipantType.MOORING);
|
||||||
|
if (mooringTimes != null)
|
||||||
|
{
|
||||||
|
switch (x.Shipcall?.Type)
|
||||||
|
{
|
||||||
|
case ShipcallType.Arrival:
|
||||||
|
if (mooringTimes.Ata.HasValue && ((DateTime.Now - mooringTimes.Ata.Value).TotalHours > 2))
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (mooringTimes.Atd.HasValue && ((DateTime.Now - mooringTimes.Atd.Value).TotalHours > 2))
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (this._sortOrder)
|
||||||
{
|
{
|
||||||
case Extensions.SortOrder.SHIP_NAME:
|
case Extensions.SortOrder.SHIP_NAME:
|
||||||
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
|
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user