def get(self): date = self.request.get('date') splitlunch = model.getSplitLunch() if date == "": schedule = model.getToday() date = model.getTime() display_date = "Today" short_date = "Today" # set some variables necessary for auto refresh block = controller.current_block(schedule) the_next_block = controller.next_block(schedule) # make a time to put into the auto refresh javascript function if block: blockeTime = controller.testeblock(block) refresh_time = block.eTime.strftime("%H,%M,01") elif the_next_block: next_blocksTime = controller.testsblock(the_next_block) refresh_time = the_next_block.sTime.strftime("%H,%M,01") else: refresh_time = None else: date = parse(date) schedule = model.getSchedule(date) display_date = model.formatDate(date) short_date = date.strftime("%a %m/%d") # short date to display in header on mobile refresh_time = None # admin check for navbar isadmin = users.is_current_user_admin() # check to see if the current date value is today is_today = (date.date() == datetime.today().date()) template_values = { 'is_today': is_today, 'display_date': display_date, 'schedule': schedule, 'splitlunch': splitlunch, 'short_date': short_date, 'isadmin': isadmin, 'refresh_time': refresh_time, 'date': date, } template = jinja_environment.get_template('schedule.html') self.response.out.write(template.render(template_values))
def get(self): date = self.request.get('date') splitlunch = model.getSplitLunch() if date == "": schedule = model.getToday() date = model.getTime() display_date = "Today" short_date = "Today" # set some variables necessary for auto refresh block = controller.current_block(schedule) the_next_block = controller.next_block(schedule) # make a time to put into the auto refresh javascript function if block: blockeTime = controller.testeblock(block) refresh_time = block.eTime.strftime("%H,%M,01") elif the_next_block: next_blocksTime = controller.testsblock(the_next_block) refresh_time = the_next_block.sTime.strftime("%H,%M,01") else: refresh_time = None else: date = parse(date) schedule = model.getSchedule(date) display_date = model.formatDate(date) short_date = date.strftime( "%a %m/%d") # short date to display in header on mobile refresh_time = None # admin check for navbar isadmin = users.is_current_user_admin() # check to see if the current date value is today is_today = (date.date() == datetime.today().date()) template_values = { 'is_today': is_today, 'display_date': display_date, 'schedule': schedule, 'splitlunch': splitlunch, 'short_date': short_date, 'isadmin': isadmin, 'refresh_time': refresh_time, 'date': date, } template = jinja_environment.get_template('schedule.html') self.response.out.write(template.render(template_values))
def isnow(i): now = model.getTime().time() if i.sTime <= now and i.eTime >= now: return True return False
def now(sTime, eTime): current = model.getTime().time() if current >= sTime and current <= eTime: return True else: return False
def next_block(schedule_list): current = model.getTime().time() for i in schedule_list: if current <= i.sTime: return i