modules/query/TripsTable.js
function _getTripByDeparture(db, originId, destinationId, departure, callback) {

  // Get Effective Services for departure date
  _buildEffectiveServiceIDString(db, departure.getDateInt(), function(err, serviceIdString) {
    if ( err ) {
      return callback(err);
    }

    // Find a matching trip
    _getMatchingTripId(db, originId, destinationId, departure, serviceIdString, function(err, tripId) {
      if ( err ) {
        return callback(err);
      }

      // --> No matching trip found
      if ( tripId === undefined ) {
        return callback(null, undefined);
      }

      // Build the matching trip...
      getTrip(db, tripId, departure.getDateInt(), function(err, trip) {
        if ( err ) {
          return callback(err);
        }

        // --> Return the matching trip
        return callback(err, trip);

      });

    });

  });

}
function _getTripByDeparture(db, originId, destinationId, departure, callback) {

  // Get Effective Services for departure date
  _buildEffectiveServiceIDString(db, departure.getDateInt(), function(err, serviceIdString) {
    if ( err ) {
      return callback(err);
    }

    // Find a matching trip
    _getMatchingTripId(db, originId, destinationId, departure, serviceIdString, function(err, tripId) {
      if ( err ) {
        return callback(err);
      }

      // --> No matching trip found
      if ( tripId === undefined ) {
        return callback(null, undefined);
      }

      // Build the matching trip...
      getTrip(db, tripId, departure.getDateInt(), function(err, trip) {
        if ( err ) {
          return callback(err);
        }

        // --> Return the matching trip
        return callback(err, trip);

      });

    });

  });

}
function _getTripByDeparture ( db , originId , destinationId , departure , callback ) { // Get Effective Services for departure date _buildEffectiveServiceIDString ( db , departure . getDateInt ( ) , function ( err , serviceIdString ) { if ( err ) { return callback ( err ) ; } // Find a matching trip _getMatchingTripId ( db , originId , destinationId , departure , serviceIdString , function ( err , tripId ) { if ( err ) { return callback ( err ) ; } // --> No matching trip found if ( tripId === undefined ) { return callback ( null , undefined ) ; } // Build the matching trip... getTrip ( db , tripId , departure . getDateInt ( ) , function ( err , trip ) { if ( err ) { return callback ( err ) ; } // --> Return the matching trip return callback ( err , trip ) ; } ) ; } ) ; } ) ; }
Get the Trip that matches the origin, destination and departure information
@param {RightTrackDB} db The Right Track DB to query
@param {string} originId Origin Stop ID
@param {string} destinationId Destination Stop ID
@param {DateTime} departure Departure DateTime
@param {function} callback getTrip callback function(err, trip)
@private
Get the Trip that matches the origin destination and departure information