Exemplo n.º 1
0
    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))
Exemplo n.º 2
0
    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))
Exemplo n.º 3
0
 def isnow(i):
     now = model.getTime().time()
     if i.sTime <= now and i.eTime >= now:
         return True
     return False
Exemplo n.º 4
0
 def isnow(i):
     now = model.getTime().time()
     if i.sTime <= now and i.eTime >= now:
         return True
     return False
Exemplo n.º 5
0
def now(sTime, eTime):
    current = model.getTime().time()
    if current >= sTime and current <= eTime:
        return True
    else:
        return False
Exemplo n.º 6
0
def next_block(schedule_list):
    current = model.getTime().time()
    for i in schedule_list:
        if current <= i.sTime:
            return i