Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  if (!isNaN(trip_length_delta)){
  2.     service.search_range_flexible_trip_length_and_wait_until_is_ready(start_date, origin, destination, trip_length, delta_start, delta_return, sort_by, trip_length_delta, function(result){
  3.      
  4.       //Test our Data prior to running update function.
  5.       console.log(chalk.red.bold("Trip_Length"));
  6.       console.log(chalk.red.bold("Trip_Length: " + result.trip_length));
  7.       console.log(chalk.red.bold("Stop_Count: " + result.legs.stop_count));
  8.       console.log(chalk.red.bold("Duration: " + result.legs.duration));
  9.  
  10.       rethinkdb.update_flights(origin, destination, result.start_date, result.return_date, result.price.amount, result.trip_length, result.legs {stop_count}, result.legs.duration, { price: result.price, legs: result.legs}); // Added result.trip_length, result.stop_count, result.duration
  11.       rethinkdb.update_cache(origin, destination, result.start_date, result.return_date, result.price.amount, { price: result.price, legs: result.legs});
  12.     }).then(function(result){
  13.       if (req.query.merge != null){
  14.         var result = _.flatten(result);
  15.         result = utils.sortResultBy(result, 'price');
  16.         var q = result.length;
  17.       }else{
  18.         var q = _.reduce(result, function(memo, l){ return memo + l.length; }, 0)
  19.       }
  20.       console.log(chalk.red.bold("Last executed queries: " + q));
  21.       res.send(result);
  22.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement