Пример #1
0
def getClassList():
    authUser = API.get_authentication()
    if not authUser:
        return render_template(login_page, error='You are not logged in')
    class_list = []
    if API.is_student(authUser.id):
        class_list = API.get_student_class_list(authUser.id)
    else:
        class_list = API.get_professor_class_list(authUser.id)
    class_info = []
    for each_class in class_list:
        class_id = API.get_class_id(each_class)
        live_lecture_id = API.get_live_lecture(class_id)
        if live_lecture_id:
            class_info.append({
                'className': each_class,
                'id': class_id,
                'liveLectureId': live_lecture_id,
                'is_live': True
            })
        else:
            class_info.append({
                'className': each_class,
                'id': class_id,
                'liveLectureId': live_lecture_id,
                'is_live': False
            })
    return jsonify(results=class_info)
Пример #2
0
def get_live_lecture(class_id):
    authUser = API.get_authentication()
    if not authUser:
        return render_template('authentication/login.html',
                               error='You are not logged in')
    liveLectureId = API.get_live_lecture(class_id)
    if liveLectureId:
        lectureId = API.get_lecture_from_live_lecture(liveLectureId)
    if liveLectureId and lectureId:
        lectureTitle = API.get_lecture_title(lectureId)
        return render_template('liveView.html',
                               username=API.get_authentication().first_name,
                               lecture_title=lectureTitle,
                               class_id=class_id,
                               user_id=API.get_authentication().id,
                               lecture_id=lectureId,
                               live_lecture_id=liveLectureId)
    return redirect(url_for('login'))
Пример #3
0
def get_live_lecture_id(class_id):
    authUser = API.get_authentication()
    if not authUser:
        return render_template('authentication/login.html',
                               error='You are not logged in')
    return jsonify(live_lecture_id=API.get_live_lecture(class_id))