Ignore:
Timestamp:
03/14/22 09:58:58 (2 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Updated the flight type handling (re #357)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/rpc.py

    r1033 r1034  
    257257            raise Exception("Invalid flight status code: '" + status + "'")
    258258
     259    @staticmethod
     260    def _convertFlightType(ft):
     261        """Convert the in-database flight-type to one of our constants."""
     262        ft = int(ft)
     263        if ft==0:
     264            return const.FLIGHTTYPE_SCHEDULED
     265        elif ft==1:
     266            return const.FLIGHTTYPE_VIP
     267        elif ft==2:
     268            return const.FLIGHTTYPE_CHARTER
     269        else:
     270            return const.FLIGHTTYPE_SCHEDULED
     271
    259272    # FIXME: copied from web.BookedFlight
    260273    @staticmethod
     
    275288    # FIXME: copied from web.BookedFlight
    276289    STATUS_REJECTED = 4
    277 
    278     # Flight type: scheduled
    279     FLIGHT_TYPE_SCHEDULED = 0
    280 
    281     # Flight type: VIP
    282     FLIGHT_TYPE_VIP = 1
    283 
    284     # Flight type: charter
    285     FLIGHT_TYPE_CHARTER = 2
    286290
    287291    # The instructions for the construction
     
    296300        "cargoWeight" : int,
    297301        "mailWeight" : int,
    298         "flightType" : int,
     302        "flightType" : lambda value: BookedFlight._convertFlightType(value),
    299303        "dow": int,
    300304        "maxPassengers": int,
Note: See TracChangeset for help on using the changeset viewer.