Route Plan

<<Back to Main Menu

Description:
A program which is run by the manager to update the Complex Routes table and to generate the Flight Search Form, the Route Search Form and the Cheapest Flights Form
Note: and explanation on the distinction between 'Routes', 'Flights', 'Route Parts' and 'Complex Routes' appears on the index page.

Accessible by:
Managers

Accessed from:
Main Menu

Input parameters:
none

Output
Generates the Flight Search Form and updates the ComplexRoutes and RoutePart tables.

Pseudo Code:
clear the contents of the Complex Routes and RoutePart tables
get routes from the Routes table
for each route { // we'll call this route1
   for each route { // we'll call this route2
      if (
            // second flight departs from arrival point of the first
            (route1's 'to' == route2's 'from')
            AND
            // you can't do the journey with only one existing route
            (there isn't a route with route1's 'from' and route2's 'to')
            AND
            // the route doesn't end up back where it started
            !(route1's 'from' == route2's 'to')
         ) {
         add to the ComplexRoutes table - 'from' is route1's 'from' and 'to' is route2's 'to'
         add to the RouteParts table an entry for each of route1 and route2. route1 is part 1 and route2 is part 2.
      }
   }
}
for each Complex Route { // we'll call this route1 (which has two parts)
   for each Route { // we'll call this route2
      if (
            //second flight departs from arrival point of the first
            (route1's 'to' == route2's 'from')
            AND
            //you can't do the journey with only one existing route
            (there isn't a route with route1's 'from' and route2's 'to')
            AND
            //you can't do the journey with a shorter complex route
            (there isn't a complex route with route1's 'from' and route2's 'to')
            AND
            //the route doesn't end up back where it started
            !(route1's 'from' == route2's 'to')
            AND
            //the route doesn't end up at the end of the first journey
            !(route1's first part's 'to' == route2's 'to')
            AND
            // AerWeb runs one of the legs of the route
            (route1's part 1, route1's part 2 or route2 is operated by AerWeb)

         ) {

         add to the ComplexRoutes table - 'from' is route1's 'from' and 'to' is route2's 'to'
         add to the RouteParts table - part 1 and part 2 are the parts for route1, part 3 is route2
      }
   }
}
delete all two-leg complex routes where neither leg is operated by AerWeb
generate the Flight Search Form