-
Notifications
You must be signed in to change notification settings - Fork 0
/
nojalisco.py
134 lines (121 loc) · 4.35 KB
/
nojalisco.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import os
from datetime import date
from random import randint
from google.appengine.ext.webapp import template
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
MONDAY = 1
TUESDAY = 2
WEDNESDAY = 3
THURSDAY = 4
FRIDAY = 5
SATURDAY = 6
SUNDAY = 7
ALL_DAYS = [x for x in range(8) if x != 0]
#LOCATIONS = ['Taqueria Jalisco', 'CJ\'s Eatery', 'Rice \'n Spice', 'Barracuda Taqueria', 'Local 360', 'The Lucky Diner', 'Boat Street Cafe', 'The 5 Point Cafe', 'Buckley\'s in Belltown', 'Sushi Wave', 'Sushi Mori', 'Belltown Pub', 'Golden Singha Thai Cuisine', 'Uptown China Restaurant', 'Mama\'s Mexican Kitchen', 'Taco Del Mar']
#LOCATIONS = ['Taqueria Jalisco (J/K)', 'CJ\'s Eatery', 'Rice \'n Spice', 'Local 360', 'The Lucky Diner', 'The 5 Point Cafe', 'Buckley\'s in Belltown', 'Sushi Wave', 'Sushi Mori', 'Belltown Pub', 'Golden Singha Thai Cuisine', 'Mama\'s Mexican Kitchen', 'Taco Del Mar']
LOCATIONS = {
'Taqueria Jalisco (J/K)': {
'availability': ALL_DAYS
},
'Buckley\'s': {
'availability': (FRIDAY,)
'description': '?'
},
'Chipotle': {
'availability': ALL_DAYS,
'description': 'The best restaurant known to mankind.'
},
'Subway': {
'availability': ALL_DAYS,
'description': 'The secrets of sandwiches that have been passed down for centuries, condensed and culminated into this restaurant.'
},
'Curb Jumper': {
'availability': (MONDAY, WEDNESDAY),
'description': "Sliders, burgers and fries."
},
'Marination': {
'availability': (TUESDAY,),
'description': 'Hawaiin-Korean cuisine'
},
'Jemil\'s': {
'availability': (TUESDAY,),
'description': 'Cajun cooking, with ro-boys'
},
'Barking Frog': {
'availability': (TUESDAY, THURSDAY),
'description': 'I have no idea what they serve, really.'
},
'Sam Choy\'s Poke': {
'availability': (WEDNESDAY,),
'description': 'Pokes! Delicous Yakitori bowls.'
},
'Plum': {
'availability': (WEDNESDAY, FRIDAY),
'description': 'Vegetarian food if you\'re into that kind of thing!'
},
'Off the Rez': {
'availability': (THURSDAY,),
'description': 'Indian Tacos'
},
'Buns': {
'availability': (FRIDAY,),
'description': 'Exactly what it sounds like.'
},
'Nosh': {
'availability': (FRIDAY,),
'description': 'Good British food, fish and chips, mushy peas.'
}
'Ferry Noodle House': {
'availability': ALL_DAYS,
'description': 'Order online at http://www.ferrynoodlehouseseattle.com'
}
'Okinawa': {
'availability': ALL_DAYS,
'description': 'The most trusted teriyaki around.'
}
'Specialty\'s': {
'availability': ALL_DAYS,
'description': 'Precision crafted sandwiches.'
}
'Mel\'s': {
'availability': ALL_DAYS,
'description': 'A little bit farther than Specialty\'s'
}
'Melange': {
'availability': (WEDNESDAY,),
'description': 'Everybody\'s favorite chicken parm.'
}
'The Metropolitan Grill': {
'availability': (SATURDAY,SUNDAY,),
'description': 'You\'re working too hard! Treat yourself.'
}
}
def make_decision(weekday):
# randint = a >= x <= b
choices = LOCATIONS.keys()
choice = None
while choice is None:
potential = choices[randint(0, len(choices)-1)]
if weekday in LOCATIONS[potential]['availability']:
choice = potential
return {
'name': choice,
'description': LOCATIONS[choice].get('description', '')
}
class MainPage(webapp.RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(path, {'restaurant': make_decision(date.today().isoweekday())}))
def post(self):
path = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(path, {'restaurant': make_decision(date.today().isoweekday())}))
application = webapp.WSGIApplication(
[
('/', MainPage),
],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()