Skip to content

Commit 872b993

Browse files
author
Miguel Yanez
committed
quick datatype changes
1 parent 2c8798a commit 872b993

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

graph_engine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import time
2+
import scraper_utils
23

34
from scraper_utils import *
45

56
import gviz_api
67

78
def graph_prices(origin, dest, dept_date, return_date):
89

9-
description = {"query_date" : ("string", "Query Date"),
10-
"min_price" : ("number", "Min Price")}
10+
description = {"query_date" : ("datetime", "Query Date"),
11+
"min_price" : ("number", "%s to %s" % (dept_date, return_date))}
1112

1213
dates = list()
1314
dates.append(dept_date)

scraper_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from dateutil.rrule import *
1414
from dateutil.parser import *
1515

16+
MO, TU, WE, TH, FR, SA, SU = weekdays = tuple(range(7))
1617

1718
def search_flights(date_pair, origin, dest):
1819

@@ -46,13 +47,13 @@ def generate_date_pairs(frequency, weekdays, start_date, until_date):
4647
return date_pairs
4748

4849
#This method returns a dict of all queried prices and query_date for a specific date_pair
49-
def get_all_prices_for_date_pair(date_pair):
50+
def get_all_prices_for_date_pair(origin, dest, date_pair):
5051

5152
result = dict()
52-
solutions = Solution.objects(depart_date=date_pair[0], return_date=date_pair[1])
53+
solutions = Solution.objects(depart_date=date_pair[0], return_date=date_pair[1], origin=origin, destination=dest)
5354

5455
for sol in solutions:
55-
query_date = sol.query_date.strftime('%m-%d-%Y')
56+
query_date = sol.query_date
5657
min_price = sol.min_price[3:] #get rid of USD
5758

5859
if (not result.has_key(query_date)):

0 commit comments

Comments
 (0)