Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/web.py

    r859 r908  
    7373                      "TU5"  : const.AIRCRAFT_T154,
    7474                      "YK4"  : const.AIRCRAFT_YK40,
    75                       "146"  : const.AIRCRAFT_B462 }
     75                      "146"  : const.AIRCRAFT_B462,
     76                      "IL6"  : const.AIRCRAFT_IL62 }
    7677
    7778    TYPE2TYPECODE = { const.AIRCRAFT_B736  : "736",
     
    9293                      const.AIRCRAFT_T154  : "TU5",
    9394                      const.AIRCRAFT_YK40  : "YK4",
    94                       const.AIRCRAFT_B462  : "146" }
     95                      const.AIRCRAFT_B462  : "146",
     96                      const.AIRCRAFT_IL62  : "IL6" }
    9597
    9698    checkFlightTypes = [ const.AIRCRAFT_B736, const.AIRCRAFT_B737,
     
    128130
    129131        flight.numPassengers = 0
     132        flight.numCockpitCrew = 2
     133        flight.numCabinCrew = 2
    130134        flight.numCrew = 2
    131135        flight.bagWeight = 0
     
    246250                                                            arrivalTime)
    247251
     252        self.numCockpitCrew = self.numCrew
     253        self.numCabinCrew = 0
     254
    248255        d = dir(self)
    249256        for attribute in ["callsign", "departureICAO", "arrivalICAO",
    250                           "aircraftType", "tailNumber",
    251                           "numPassengers", "numCrew",
     257                          "aircraftType", "tailNumber", "numPassengers",
     258                          "numCrew", "numCockpitCrew", "numCabinCrew",
    252259                          "bagWeight", "cargoWeight", "mailWeight",
    253260                          "route", "departureTime", "arrivalTime"]:
     
    279286
    280287        self.aircraftType = \
    281           self._decodeAircraftType(bookedFlightData["aircraftType"])
     288          self._decodeAircraftICAOType(bookedFlightData["aircraftType"])
    282289        self.tailNumber = bookedFlightData["tailNumber"]
    283290        self.numPassengers = int(bookedFlightData["numPassengers"])
    284         self.numCrew = int(bookedFlightData["numCrew"])
     291        self.numCockpitCrew = int(bookedFlightData["numCockpitCrew"])
     292        self.numCabinCrew = int(bookedFlightData["numCabinCrew"])
     293        self.numCrew = self.numCockpitCrew + self.numCabinCrew
    285294        self.bagWeight = int(bookedFlightData["bagWeight"])
    286295        self.cargoWeight = int(bookedFlightData["cargoWeight"])
     
    327336            raise Exception("Invalid aircraft type code: '" + typeCode + "'")
    328337
     338    def _decodeAircraftICAOType(self, typeCode):
     339        """Decode the aircraft type from the given typeCode."""
     340        if typeCode in const.icao2Type:
     341            return const.icao2Type[typeCode]
     342        else:
     343            raise Exception("Invalid aircraft type code: '" + typeCode + "'")
     344
    329345    def __repr__(self):
    330346        """Get a representation of the flight."""
     
    815831            result.types = loginResult[2]
    816832            result.password = password
     833
     834            result.aircraftTypes = client.getTypes()
     835
    817836            flights = client.getFlights()
    818837            result.flights = flights[0]
    819838            result.reportedFlights = flights[1]
    820839            result.rejectedFlights = flights[2]
     840
    821841            if result.rank=="STU":
    822842                reply = client.getEntryExamStatus()
Note: See TracChangeset for help on using the changeset viewer.