Flight Record¶
Represents a single record in the Startkladde flights table, which contains
one record for each flight stored in the database.
Interface¶
-
class
pysk.db.model.Flight(id=None, plane_id=None, pilot_id=None, copilot_id=None, type=None, mode=None, departed=None, landed=None, towflight_landed=None, launch_method_id=None, departure_location=None, landing_location=None, num_landings=None, departure_time=None, landing_time=None, towplane_id=None, towflight_mode=None, towflight_landing_location=None, towflight_landing_time=None, towpilot_id=None, pilot_last_name=None, pilot_first_name=None, copilot_last_name=None, copilot_first_name=None, towpilot_last_name=None, towpilot_first_name=None, comments=None, accounting_notes=None)¶ Representation of a flight in the startkladde database
Implements a single record in the Startkladde
flightstable. Each member represents the value of the column with the same name and type.Parameters: - id (int) – ID of this record in table
flights. - plane_id (int) – ID of
Airplanerecord in tableplanes(ref. Airplane Record) - pilot_id (int) – ID of
Pilotrecord for the pilot in command (or student for two seated training) in tablepeople(ref. Pilot Record). - copilot_id (int) – ID of
Pilotrecord for the copilot (or instructor in two seated training) in tablepeople(ref. Pilot Record). - type (str) –
Flight type. One of
- ‘normal‘ (normal flight)
- ‘training_1‘ (one seated training)
- ‘training_2‘ (two seated training)
- ‘guest_external‘ (guest flight)
- ‘guest_private‘ (private guest flight)
- mode (str) –
Flight mode. One of
- ‘local‘
- ‘inbound‘
- ‘outbound‘
- departed (int) –
1if flight is departed,0otherwise. - landed (int) –
1if flight is landed,0otherwise. - towflight_landed (int) –
1if towflight landed,0otherwise. - launch_method_id (int) – ID of applicable
LaunchMethodrecord in tablelaunch_methods(ref. Launch Method Record) - location (departure) – Departure location
- landing_location (str) – Landing location
- num_landings (int) – Number of landings
- departure_time (
datetime) – Departure time - landing_time (
datetime) – Landing time - towplane_id (int) – ID of
Airplanerecord for towplane in tableplanes(ref. Airplane Record). - towflight_mode (int) – Mode of towflight. Same values as in mode
- towflight_landing_location (str) – Location of tow flight landing
- towflight_landing_time (
datetime) – Landing time of tow plane - towpilot_id – ID of
Pilotrecord for the towpilot in tablepeople(ref. Pilot Record). - pilot_last_name (str) – Deprecated. Should be
None. - pilot_first_name (str) – Deprecated. Should be
None. - copilot_last_name (str) – Deprecated. Should be
None. - copilot_first_name (str) – Deprecated. Should be
None. - towpilot_last_name (str) – Deprecated. Should be
None. - towpilot_first_name (str) – Deprecated. Should be
None. - comments (str) – Eventual comments
- accounting_notes (str) – Eventual accounting notes
-
__lt__(other)¶ Compare two flights by their respective departure times
Parameters: other ( Flight) – Instance to compare self toReturns: Trueif and only ifself.departure_time<other.departure_time
-
__str__()¶ Convert instance to string
Returns: ‘ departure_timedeparture_location‘
-
departureTime(format=None)¶ Get departure time as string.
Parameters: format (str) – Output format (in strftimenotation). Defaults toTIME_FORMAT.Returns: Departure time as string in given format for local and outbound flights. Departure location for inbound flights.
-
duration()¶ Get flight time
Returns: Flight time as timedeltaobject
-
landingTime(format=None)¶ Get landing time as string.
Parameters: format (str) – Output format (in strftimenotation). Defaults toTIME_FORMAT.Returns: Landing time as string in given format for local and inbound flights. Landing location for outbound flights.
-
pic()¶ Get pilot in command
Returns: ID of pilot in command
-
similar(other)¶ Check if two flights are conflicting.
Two flights are similar, if and only if their flight times overlap and either pilot and/or plane and/or copilot are identical.
Parameters: other ( Flight) – flight to check current instance againstReturns: Trueif and only if self and other are similar
-
static
tableName()¶ Get name of MySQL table, where this data type is used
Returns: ‘flights‘
-
update()¶ Update members
departed,landedandtowflight_landedSets members
self.departed,self.landedandself.towflight_landedfrom the information provided throughlanding_time,departure_timeandtowflight_landing_time
- id (int) – ID of this record in table