def grade_assignment(codecool):
    """
    Changes grade attribute in assignment submission object

    Args:
        codecool (obj): School object - aggregate all users and assignments

    Returns:
        None
    """

    mentor_view.print_students_list(codecool)
    student_id = ui.get_inputs([''], 'Choose student id')

    try:
        student = choose_student_by_id(int(student_id[0]), codecool)
        id_ = 1
        for subm in student.assignment_submissions:
            assignment_submission_view.print_submission(id_, subm)
            id_ += 1
        id_ = ui.get_inputs(['id'], 'Provide submission id:')[0]

        try:
            submission_to_mark = choose_submission_by_id(id_, student)
        except ValueError:
            ui.print_error_message('No such submission')

        try:
            submission_to_mark.grade = int(ui.get_inputs(['mark'], 'Provide mark')[0])
        except ValueError:
            ui.print_error_message('Grade must be integer number')

    except ValueError:
        ui.print_error_message('There is no such student')
Example #2
0
def get_choice():
    possible_choices = ['0', '1', '2', '3', '4']
    choice = ''
    while choice not in possible_choices:
        choice = ui.get_inputs(['option:'], 'Choose option')[0]

    return choice
Example #3
0
def get_new_user_data(data_type):
    '''
    Asks user for information about attr and returns answer
    Args:
        data_type: str from ['name', 'surname', 'login', 'password', 'email', 'phone']
    Returns:
        data: str
    '''

    data = ui.get_inputs([data_type], 'Provide data for user')

    return data
Example #4
0
def get_assignment_submission_content():
    return ui.get_inputs(['content:'], 'Provide content')[0]
Example #5
0
def get_assignment_id():
    return ui.get_inputs(['assignment id:'], 'Provide assignment id')[0]
def get_id():
    return ui.get_inputs(['id:'], 'Provide id')[0]
Example #7
0
def get_mail_data():
    return ui.get_inputs(['Title:', 'Message:'],
                         'Provide title and message of mail')
Example #8
0
def get_receiver():

    return ui.get_inputs(['id'], 'Provide id')[0]
Example #9
0
def get_mail_idx(mail_list):
    idx = ui.get_inputs(['idx'], 'Provide idx')
    return idx[0]