Пример #1
0
def students_dashboard():
    search = request.args.get('search')

    # handle search bar requests
    if search is not None:
        students_list = StudentsFinder.get_from_search(search)
    else:
        search = None
        students_list = StudentsFinder.get_all()

    if students_list is None or len(students_list) == 0:
        error = 'No students found'
        return render_template(
            'admin/students_app/students/students_dashboard.html',
            students=None,
            error=error,
            search=search,
            current_user=current_user)

    return render_template(
        'admin/students_app/students/students_dashboard.html',
        students=students_list,
        error=None,
        search=search,
        current_user=current_user)
Пример #2
0
def reset_daily_points():
    squads = SquadsFinder.get_all()
    for squad in squads:
        if not SquadsHandler.reset_daily_points(squad):
            return APIErrorValue("Reset failed").json(500)

    students = StudentsFinder.get_all()
    for student in students:
        if not StudentsHandler.reset_daily_points(student):
            return APIErrorValue("Reset failed").json(500)

    return jsonify("Success"), 200