Esempio n. 1
0
def handle_answerPost(doubtId, answer):
    # $$$$ Professors are not supported to solve doubts
    currentClass = runningClasses[su.get_class_id(session)]
    solvedDoubt = currentClass.getDoubt(doubtId)                    # We are using variables in memory
    solver = DBUtils.getStudentBy_id(su.get_student_id(session))    # Student solver
    room = su.get_classRoom(session)                                # Room to send the response

    # Update currentClass.doubts and db
    solvedDoubt.add_Answer(answer, solver)                          # Do not use DBUtils.

    answerJson = '{"doubtid":' + str(doubtId) + ',"text":"' + answer + '"}'
    socketio.emit('new_answer', answerJson, room=room)
Esempio n. 2
0
def handle_postDoubt(text):
    '''
    New doubt from a student. Stores the doubt in the system and send it to all other students and professor
    :param text:
    :return:
    '''
    currentClass = runningClasses[su.get_class_id(session)]
    currentGroup = currentClass.studentGroups[su.get_grupo_id(session)]
    page_no = currentGroup.assigmentProgress

    doubtText = text
    doubt = Doubt(doubtText, currentClass.assigment.sections[page_no - 1], currentGroup)
    doubt.postToDB()
    currentClass.addDoubt(doubt)
    currentGroup.doubts.append(doubt)

    flash('Doubt sent', 'success')

    # Notify to Professor and Students
    room = su.get_classRoom(session)
    socketio.emit('doubt_new', doubt.JSON(), room=room)
Esempio n. 3
0
def handle_assigmentChangePage(group: StudentGroup):
    room = su.get_classRoom(session)
    socketio.emit('assigment_changeProgress', group.JSON())
Esempio n. 4
0
def removeGroup(group):
    currentClass = runningClasses[su.get_class_id(session)]
    # stateJson = currentClass.JSON()
    room = su.get_classRoom(session)
    socketio.emit('removeGroup', group.JSON(), room=room)