def dashboard(): """ Student Dashboard. """ # Get the current time. now = datetime.now() # Select the future lessons. future_lessons = select_future_lessons(current_user) # Select all the past lessons, that were attended. (Limit to 5) attended_lessons_assoc = select_lessons_assoc( current_user, max_date=now, attendance_codes=('A', 'L'), date_order_asc=True, limit=5 ) # Select all the past lessons, that have not been recorded. unknown_lessons_assoc = select_lessons_assoc( current_user, max_date=now, attendance_code=None, date_order_asc=True ) # Render the dashboard template, passing in the lessons selected from the database. return render_template( 'student/dashboard.html', lessons=future_lessons, attended_lessons_assoc=attended_lessons_assoc, unknown_lessons_assoc=unknown_lessons_assoc )
def lessons(): """ All Lessons. """ # Select all the lessons, where the student is the current user, and the lessons # are in the future. upcoming_lessons = select_future_lessons(current_user) # Select all previous lessons, where the student is the current user, and the lessons # are in the past. previous_lessons = select_past_lessons(current_user) # Render the template passing in the lessons selected from the database. return render_template( 'student/lessons.html', upcoming_lessons=upcoming_lessons, previous_lessons=previous_lessons )