Пример #1
0
def handle_postDoubt(text, groupId):
    '''
    New doubt from a student. Stores the doubt in the system and send it to all other students and professor
    :param text:
    :return:
    '''
    print('HANDLE_ POST DOUBT')
    print('DUDA group_id_aux 2: ' + str(group_id_aux))
    print('DUDA class id aux 2: ' + str(class_id_aux))

    currentClass = runningClasses[class_id_aux]
    group = currentClass.studentGroups[groupId]
    page_no = group.assigmentProgress

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

    group.doubts.append(doubt)

    # Notify to Professor and Students
    # room = su.get_classRoom(session)
    socketio.emit('doubt_new', doubt.JSON())
Пример #2
0
def hadle_queryDoubts():
    '''
    Handles a petition for all doubts and answers in the system. Sends the doubts to how asked for them.
    :return:
    '''
    currentClass = runningClasses[su.get_class_id(session)]
    doubtsJson = currentClass.JSON()                                # JSON string with doubts structure
    room = su.get_ownRoom(session)                                  # Who asked for doubts
    socketio.emit('doubt_query_result', doubtsJson, room=room)
Пример #3
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)
Пример #4
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)
Пример #5
0
def handle_joinGroup(group: StudentGroup):
    socketio.emit('joinedGroup', group.JSON(), broadcast=True)
Пример #6
0
def handle_solvedDoubt(data):
    print('handle_solvedDoubt')
    currentClass = runningClasses[class_id_aux]
    currentGroup = currentClass.studentGroups[group_id_aux]
    data = currentGroup
    socketio.emit('the_doubt_solved', data)
Пример #7
0
def handle_getUser():

    print('HANDLE_ GET USER')
    currentClass = runningClasses[class_id_aux]
    currentGroup = currentClass.studentGroups[group_id_aux]
    socketio.emit('get_user', currentGroup.JSON())
Пример #8
0
def handle_get_doubts():

    print('HANDLE_ get_doubts')
    socketio.emit('get_doubts2', doubts_container)
Пример #9
0
def handle_assigmentChangePage(group: StudentGroup):
    room = su.get_classRoom(session)
    socketio.emit('assigment_changeProgress', group.JSON())
Пример #10
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)
Пример #11
0
def hadle_queryDoubts():
    currentClass = runningClasses[su.get_class_id(session)]
    stateJson = currentClass.JSON()
    room = su.get_ownRoom(session)
    socketio.emit('classroom_query_result', stateJson, room=room)