cadets-ca / ets

MIT License
5 stars 3 forks source link

Ability to log more than 1 passenger in tow aircraft #7

Open markmacpherson opened 5 years ago

markmacpherson commented 5 years ago

Pacific Region conducts fam flying in their 182 tow planes that can accommodate up to 3 passengers. The app currently only supports 1 passenger. They need the ability to log all passengers in the plane while conducting fam ops with these aircraft.

kirvanp commented 5 years ago

Adding this will require the following general steps:

1) Create a new version of the SQL model 2) Add "Passenger2" and "Passenger3" relationships to the Aircraft entity 3) Similarly, the FlightRecord entity that stores the records of each flight permanently would need a "Passenger2" and "Passenger3" relationship added 4) Add a number of passengers field to the plist from which the app loads the aircraft attributes so that the app knows which aircraft support 3 passengers 5) Add 2nd and 3rd passenger fields to the "Edit Aircraft" view controller that shows up when you tap an aircraft 6) Revamp the aircraft UI in the "Airplanes" view controller which controls how the aircraft appear in the right side of the app.

An alternative to #2 would be to change Passenger from a one-to-one relationship to a to-many one. However, this could break code in some places. For example, if Bloggins is already a passenger in a glider and we add Smith as passenger in that same glider, Core Data, which manages the SQL database, will currently automatically remove the relationship between the glider and Bloggins. If passenger becomes a to-many relationship, then that code would incorrectly result in both of them being passengers in the same glider. We would have to add a check to find and remove existing passengers for 2 seat aircraft when adding a new one.

After this some general debugging will be required, because the app does not currently look for flights flown as second or third passenger so they would not, for example, appear in a pilot's list of past flights or log book. That said, the 2nd and 3rd passengers would generally not be pilots and even if they are the time would not be loggable, so this might not actually matter. Nevertheless the potential ramifications of having multiple passengers would have to be studied.

Overall this change is certainly doable but would take a bit of work.

huguesf commented 5 years ago

I would suggest we go with the to-many relationship as all the checks (same passenger to more than once on a flight, same passenger not on two different flights at the same time), would need to be changed anyway, and are simpler when looking at a simple place (same relationship tables). That relationship would then be limited by the max number of passenger.