File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -268,7 +268,11 @@ async def schoolweektoday(request):
268268async def schoolweek (request , requested_date_str ):
269269 # TODO: webscrape online calendar to get days off
270270 # TODO: possibly save days in sql db so email notifs can quickly access the day without processing all the info every time
271+ requested_date = date (* map (int , requested_date_str .split ('-' )))
271272 first_day = date (2020 , 9 , 8 )
273+ if not first_day <= requested_date <= date (2021 , 6 , 11 ):
274+ abort (404 , message = f'Requested URL { request .path } not found' )
275+
272276 no_school = [
273277 date (2020 , 9 , 28 ), # Yom Kippur
274278 date (2020 , 10 , 12 ), # Columbus day
@@ -287,7 +291,6 @@ async def schoolweek(request, requested_date_str):
287291 0 : 'B'
288292 }
289293
290- requested_date = date (* map (int , requested_date_str .split ('-' )))
291294 next_friday = thisweek (requested_date )[- 1 ]
292295 elapsed_dates = daterange (first_day , next_friday )
293296 mondays = [d for d in elapsed_dates if d .weekday () == 0 and d not in no_school ]
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ <h5>Maroon and gray A and B days for the week of {{ requested_date.strftime('%m/
1010 < label class ="label " for ="requested-date " style ="margin-top: 5px; "> Choose date</ label >
1111 < input type ="date " id ="requested-date " name ="requested-date "
1212 value ="{{ requested_date }} "
13- min ="2020-09-05 " max ="2021-06-11 " onchange ="onDateChange(event); ">
13+ min ="2020-09-08 " max ="2021-06-11 " onchange ="onDateChange(event); ">
1414</ div >
1515< table >
1616 < tr class ="week-calendar ">
You can’t perform that action at this time.
0 commit comments