Changeset 1161:38b1f077d211 for src/mlx


Ignore:
Timestamp:
04/28/24 07:49:42 (7 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Arriving earlier is never a warning or error to be explaned

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/flight.py

    r1106 r1161  
    5555    @staticmethod
    5656    def isTimeDifferenceTooMuch(scheduledTime, realTimestamp,
    57                                 earlyOnlyWarning = False):
     57                                earlyOnlyWarning = False,
     58                                earlyOK = False):
    5859        """Determine if the given real time differs to much from the scheduled
    5960        time.
     
    6970        realMinute = realTime.tm_hour * 60 + realTime.tm_min
    7071
    71         diff = abs(Flight.getMinutesDifference(scheduledMinute, realMinute))
    72 
    73         return (diff>Flight.TIME_WARNING_DIFFERENCE,
    74                 False if earlyOnlyWarning else diff>Flight.TIME_ERROR_DIFFERENCE)
     72        diff = Flight.getMinutesDifference(scheduledMinute, realMinute)
     73
     74        return (diff<-Flight.TIME_WARNING_DIFFERENCE or
     75                (not earlyOK and diff>Flight.TIME_WARNING_DIFFERENCE),
     76                diff<-Flight.TIME_ERROR_DIFFERENCE or
     77                (not earlyOK and not earlyOnlyWarning
     78                 and diff>Flight.TIME_ERROR_DIFFERENCE))
    7579
    7680    def __init__(self, logger, gui):
     
    389393        return self.isTimeDifferenceTooMuch(self.bookedFlight.arrivalTime,
    390394                                            self.blockTimeEnd,
    391                                             earlyOnlyWarning = True)
     395                                            earlyOK = True)
    392396
    393397    def disconnected(self):
Note: See TracChangeset for help on using the changeset viewer.