Permalink
Browse files

Better error message for deck/savannah conflicts

  • Loading branch information...
1 parent 669bcda commit 81f76e6b0f8003e9803d9ac7b751acbe78be6f2c @dustball dustball committed Nov 11, 2011
Showing with 10 additions and 3 deletions.
  1. +8 −2 main.py
  2. +2 −1 models.py
View
10 main.py
@@ -204,7 +204,10 @@ def post(self, id):
self.request.get('end_time_ampm')), '%m/%d/%Y %I:%M %p')
conflicts = Event.check_conflict(start_time,end_time,self.request.get_all('rooms'), int(id))
if conflicts:
- raise ValueError('Room conflict detected')
+ if "Deck" in self.request.get_all('rooms') or "Savanna" in self.request.get_all('rooms'):
+ raise ValueError('Room conflict detected <small>(Note: Deck &amp; Savanna share the same area, two events cannot take place at the same time in these rooms.)</small>')
+ else:
+ raise ValueError('Room conflict detected')
if not self.request.get('estimated_size').isdigit():
raise ValueError('Estimated number of people must be a number')
if not int(self.request.get('estimated_size')) > 0:
@@ -447,7 +450,10 @@ def post(self):
self.request.get('end_time_ampm')), '%m/%d/%Y %I:%M %p')
conflicts = Event.check_conflict(start_time,end_time,self.request.get_all('rooms'))
if conflicts:
- raise ValueError('Room conflict detected')
+ if "Deck" in self.request.get_all('rooms') or "Savanna" in self.request.get_all('rooms'):
+ raise ValueError('Room conflict detected <small>(Note: Deck &amp; Savanna share the same area, two events cannot take place at the same time in these rooms.)</small>')
+ else:
+ raise ValueError('Room conflict detected')
if not self.request.get('estimated_size').isdigit():
raise ValueError('Estimated number of people must be a number')
if not int(self.request.get('estimated_size')) > 0:
View
3 models.py
@@ -82,8 +82,9 @@ def get_large_list(cls):
def get_approved_list(cls):
return cls.all() \
.filter('start_time >', local_today()) \
+ # .filter('start_time <', local_today() + timedelta(days=60)) \
.filter('status IN', ['approved', 'canceled']) \
- .order('start_time').fetch(200)
+ .order('start_time')
@classmethod
def get_recent_past_and_future(cls):

0 comments on commit 81f76e6

Please sign in to comment.