Changeset 769:d10b450fff75 for src/mlx/web.py
- Timestamp:
- 04/24/16 12:50:26 (8 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/web.py
r764 r769 91 91 const.AIRCRAFT_B462 : "146" } 92 92 93 checkFlightTypes = [ const.AIRCRAFT_B736, const.AIRCRAFT_B737, 94 const.AIRCRAFT_B738, const.AIRCRAFT_DH8D ] 95 93 96 @staticmethod 94 97 def getDateTime(date, time): … … 96 99 return datetime.datetime.strptime(date + " " + time, 97 100 "%Y-%m-%d %H:%M:%S") 101 102 @staticmethod 103 def forCheckFlight(aircraftType): 104 """Create a booked flight for a check flight with the given aircraft 105 type.""" 106 flight = BookedFlight() 107 108 flight.departureICAO = "LHBP" 109 flight.arrivalICAO = "LHBP" 110 111 flight.aircraftType = aircraftType 112 flight.aircraftTypeName = BookedFlight.TYPE2TYPECODE[aircraftType] 113 114 # FIXME: perhaps find one for the type 115 flight.tailNumber = "HA-CHK" 116 flight.callsign = "HA-CHK" 117 118 flight.numPassengers = 0 119 flight.numCrew = 2 120 flight.bagWeight = 0 121 flight.cargoWeight = 0 122 flight.mailWeight = 0 123 flight.route = "DCT" 124 125 t = datetime.datetime.now() + datetime.timedelta(minutes = 20) 126 flight.departureTime = datetime.datetime(t.year, t.month, t.day, 127 t.hour, t.minute) 128 t = flight.departureTime + datetime.timedelta(minutes = 30) 129 flight.arrivalTime = datetime.datetime(t.year, t.month, t.day, 130 t.hour, t.minute) 131 132 return flight 98 133 99 134 def __init__(self, id = None): … … 741 776 result.entryExamLink = reply[1] 742 777 result.checkFlightStatus = reply[2] 778 if reply[3]: 779 result.rank = "FO" 743 780 744 781 return result … … 761 798 result.entryExamLink = reply[1] 762 799 result.checkFlightStatus = reply[2] 800 result.madeFO = reply[3] 763 801 764 802 return result … … 1156 1194 #------------------------------------------------------------------------------ 1157 1195 1196 class SetCheckFlightPassed(RPCRequest): 1197 """A request to mark the user as one having passed the check flight.""" 1198 def __init__(self, client, callback, aircraftType): 1199 """Construct the request for the given type.""" 1200 super(SetCheckFlightPassed, self).__init__(client, callback) 1201 self._aircraftType = aircraftType 1202 1203 def run(self): 1204 """Perform the update.""" 1205 aircraftType = BookedFlight.TYPE2TYPECODE[self._aircraftType] 1206 self._client.setCheckFlightPassed(aircraftType) 1207 return Result() 1208 1209 #------------------------------------------------------------------------------ 1210 1158 1211 class Handler(threading.Thread): 1159 1212 """The handler for the web services. … … 1232 1285 self._addRequest(SendBugReport(callback, summary, description, email)) 1233 1286 1287 def setCheckFlightPassed(self, callback, aircraftType): 1288 """Mark the check flight as passed.""" 1289 self._addRequest(SetCheckFlightPassed(self._rpcClient, 1290 callback, aircraftType)) 1291 1234 1292 def run(self): 1235 1293 """Process the requests."""
Note:
See TracChangeset
for help on using the changeset viewer.