def handle_menu(user):
        '''
        Allows to choose an action to perform.
        '''
        options = ['View grades', "Submit an assignment", 'View attandence']

        while True:

            Ui.print_message(('\n...:::Logged in as {}:::...\n').format(user))
            Ui.print_menu("What do you want to do?", options, 'Exit')
            inputs = Ui.get_inputs(["Please enter a number: "], "")
            option = inputs[0]

            if option == '1':
                StudentMenu.show_grades(user)

            elif option == '2':
                os.system('clear')
                user.submit_assignment()

            elif option == '3':
                StudentMenu.show_attendance(user)

            elif option == '0':
                Common.write_submission_to_db('database.db',
                                              Submission.submission_list)
                sys.exit()
            else:
                Ui.print_message('There is no such option.')
예제 #2
0
 def change_student_attendance(student_id):
     """
     Changes student's attendance of a date you choose inside
     :param student_id: str
     """
     os.system("clear")
     Ui.print_message("Please set up a date.")
     day_list = Attendance.set_date()
     try:
         day_str = "-".join(day_list)
     except:
         return
     option_list = Ui.get_inputs(["New status: "], "0 - upsent, 1 - late, 2 - present\n\n")
     if Common.error_integer_handling(option_list[0], 2):
         student_status = option_list[0]
         for studenten in Student.student_list:
             if studenten.id == student_id:
                 counter = 0
                 status = None
                 for day_obj in studenten.attendance_list:
                     if day_obj.data == day_str:
                         counter += 1
                         day_obj.status = student_status
                         status = day_obj.status
                 if counter == 0:
                     Ui.get_inputs([""], "Nothing changed. Attendance hadn't been found with such date.")
                 else:
                     Ui.get_inputs([""], "\nStudent's status has been successfully changed.\n"
                                         "Current student's status in {}: {}".format(day_str, status))
예제 #3
0
    def log_in(cls):
        '''
        Handles logging in as user based on given email and password.
        Redirects to specific submenu.
        '''
        login = Ui.get_inputs(['Please enter your email: '], "")
        password = []
        passw = getpass.getpass('Enter pass: '******'Invalid login or password. Please try again. ')
        elif user:
            os.system('clear')
            Ui.print_message('\nHello, ' + user.name + '!\n')
            time.sleep(2)
            if user.status == 'manager':
                Menu.loading_data()
                ManagerMenu.handle_menu(user)
            elif user.status == 'employee':
                Menu.loading_data()
                EmployeeMenu.handle_menu(user)
            elif user.status == 'mentor':
                Menu.loading_data()
                MentorMenu.handle_menu(user)
            elif user.status == 'student':
                Menu.loading_data()
                StudentMenu.handle_menu(user)
        return None
예제 #4
0
 def main():
     os.system('clear')
     Menu.loading_people()
     while True:
         Menu.main_menu()
         try:
             Menu.choose_option()
         except KeyError:
             Ui.print_message('Unknown error at main!')
예제 #5
0
    def view_assignment_list():
        """
        method prints the list or error_message if list is empty
        """

        if len(Assignments.assignments_list) == 0:
            Ui.print_message("Assignment list is empty")
        else:
            Ui.print_assignments_list(Assignments.assignments_list,
                                      "Assignments List:")
예제 #6
0
 def edit_email(cls, person):
     '''
     Allows to change person object's attribute.
     '''
     new_email = Ui.get_inputs(['Enter new email: '], " ")
     if not new_email[0]:
         Ui.print_message('email cannot be empty.')
     else:
         person.email = new_email[0]
         Ui.print_message("\nEmail has been changed.\n")
         Ui.get_inputs([''], "Click enter to go back")
예제 #7
0
 def edit_surname(cls, person):
     '''
     Allows to change person object's attribute.
     '''
     new_surname = Ui.get_inputs(['Enter new surname: '], " ")
     if not new_surname[0]:
         Ui.print_message("\nSurname cannot be empty.\n")
     else:
         person.surname = new_surname[0]
         Ui.print_message("\nSurname has been changed.\n")
         Ui.get_inputs([''], "Click enter to go back")
예제 #8
0
 def choose_option(cls):
     '''
     Allows user to log in or exit program.
     '''
     inputs = Ui.get_inputs(["Please enter a number: "], "")
     option = inputs[0]
     if option == "1":
         Menu.log_in()
     elif option == "0":
         sys.exit(0)
     else:
         Ui.print_message('There is no such option.')
예제 #9
0
 def edit_password(cls, person):
     '''
     Allows to change person object's attribute.
     '''
     choosing = True
     while choosing:
         new_password = Ui.get_inputs(['Enter new password: '******'Enter password again: '], " ")
         if new_password[0] == confirm_password[0]:
             person.email = new_password[0]
             Ui.print_message("\nPassword has been changed.\n")
         else:
             Ui.print_message("\nEntered passwords are not identical.\n")
예제 #10
0
 def remove_person(cls, object_list):
     '''
     Arg: object_list - list of objects (student, mentors etc.).
     Allows to remove person object from list of given objects.
     Returns updated list of objects.
     '''
     to_remove = Ui.get_inputs(['-> '],
                               "Enter ID of person you want to remove:")
     for person in object_list:
         if person.id == to_remove[0]:
             object_list.remove(person)
             Ui.print_message("Person removed")
             Ui.get_inputs([''], "Click enter to go back")
     return object_list
예제 #11
0
 def choose_person_to_change_data(cls, object_list):
     '''
     Handles choosing person to change his or her data.
     '''
     choosing = True
     while choosing:
         option = Ui.get_inputs(["Enter person ID or 'q' to go back: "],
                                "Choose person: ")
         for person in object_list:
             if option[0] == person.id:
                 return person
         if option[0] == 'q':
             choosing = False
         else:
             Ui.print_message('No id match.')
예제 #12
0
 def data_to_change(cls, person):
     '''
     Handles choosing which data to change.
     '''
     choosing = True
     while choosing:
         Ui.print_data_list('Data list: ')
         choice = Ui.get_inputs(["Enter a number or 'q' to go back: "],
                                'Which data do you want to edit?')
         if choice[0] == '1':
             return cls.edit_name(person)
         elif choice[0] == '2':
             return cls.edit_surname(person)
         elif choice[0] == '3':
             return cls.edit_email(person)
         elif choice[0] == 'q':
             choosing = False
         else:
             Ui.print_message('There is no such option.')
             time.sleep(3)
예제 #13
0
 def check_attendance_for_day(day_str):
     """
     :param day: date (e.g. 2017-01-08)
     """
     for student in Student.student_list:
         while True:
             student_attendance = Ui.get_inputs(["Student status:\n   0 - upsent\n   1 - late\n   2 - present\n"], student)
             if Common.error_integer_handling(student_attendance[0], 2):
                 student_status = student_attendance[0]
                 if student_status == "1":
                     student_status = "80"
                 if student_status == "2":
                     student_status = "100"
                 att = Attendance(day_str, student_status, student.id)
                 student.attendance_list.append(att)
                 Attendance.attendances_list.append(att)
                 Ui.print_message("\nDone.\n")
                 break
             else:
                 continue
예제 #14
0
    def view_students_attendance():
        """
        Shows students attendance to school.
        """
        os.system("clear")
        Ui.print_message("...::: Students attendance\n\n")
        for student in Student.student_list:
            attendance_points = 0
            counter = 0
            for one_day_obj in student.attendance_list:
                counter += 1
                attendance_points += int(one_day_obj.status)

            if counter == 0:
                Ui.get_inputs([""], "No dates to show.")
                break
            else:
                average_attendance = attendance_points / counter
                Ui.print_message("{}: {}".format(student, average_attendance))
        Ui.get_inputs([""], "")
예제 #15
0
 def date_control():
     """
     Full checking of date correctness.
     :return:  str date (e.g. "2017-01-25")
     """
     os.system("clear")
     while True:
         os.system("clear")
         date_list = Attendance.set_date()
         if date_list == None:
             return None
         date_str = "-".join(date_list)
         if date_str > str(datetime.date.today()):
             Ui.print_message("No way my friend.")
             wait = Ui.get_inputs([""], "")
             continue
         for day in Attendance.attendances_list:
             if day.data == date_str: #  day.data == str
                 Ui.print_message("You have already checked attendance for this day.")
                 remember = True
                 wait = Ui.get_inputs([""], "")
                 Attendance.attendance_mini_menu()
         return date_str
예제 #16
0
 def choose_student():
     """
     Chooses student from Student.student_list
     :return: str: student's id
     """
     while True:
         os.system("clear")
         Ui.print_message("Which student do you want to choose?\n")
         for number, student in enumerate(Student.student_list):
             Ui.print_message("  {}: {}".format(number + 1, student))
         Ui.print_message("  0: Go back\n")
         option_list = Ui.get_inputs([""],"")
         user_option = option_list[0]
         if Common.error_integer_handling(user_option, len(Student.student_list)):
             if user_option[0] == "0":
                 return None
             for number, student in enumerate(Student.student_list):
                 if number + 1 == int(user_option):
                     return student.id
예제 #17
0
 def add_person(cls, object_list):
     '''
     Arg: object_list - list of objects (students, mentors etc.).
     Function allows to add new person object to a list of given type of objects.
     Returns updated list of objects.
     '''
     os.system('clear')
     data = Ui.get_inputs(
         ['Name: ', 'Surname: ', 'email: ', 'Password: '******'Status: '],
         "Please provide information:")
     id = Common.generate_random_id(object_list)
     if data[0] == '' or data[1] == '' or data[2] == '' or data[3] == '':
         Ui.print_message("\nValue can't be empty")
     elif '@' and '.' not in data[2]:
         Ui.print_message("Enter proper email format")
     else:
         new_person = cls(data[0], data[1], data[2], data[3], data[4], id)
         object_list.append(new_person)
         Ui.print_message('Person added!')
         Ui.get_inputs([''], "Click enter to go back")
     return object_list
    def handle_menu(user):
        '''
        Allows to choose an action to perform.
        '''
        options = ["View students list", "Get toilet paper"]
        while True:
            Ui.print_message(('\n...:::Logged in as {}:::...\n').format(user))
            Ui.print_menu("\nWhat you want to do?", options, "Log out")
            inputs = Ui.get_inputs(["Please enter a number: "], "")
            option = inputs[0]
            if option == '1':
                ManagerMenu.show_students()
            elif option == '2':
                os.system('clear')
                Ui.print_message(
                    '\nToilet paper has been purchased.\nCongratulations!!!!!\n\n\n:)))'
                )
                Ui.get_inputs([''], 'Press enter to go back')

            elif option == '0':
                sys.exit()
            else:
                Ui.print_message('There is no such option.')
 def grade_an_submission(cls):
     """
     method change the argument (grade) of object from submissions list
     """
     Ui.print_submissions_list(Submission.submission_list,
                               "Submission list:")
     sub_to_grade = Ui.get_inputs(
         ['Submission name: ', 'ID: '],
         'Type submission name, and student ID which you want to grade: \n')
     found = False
     for sub in Submission.submission_list:
         if sub.name == sub_to_grade[0] and sub.student_id == sub_to_grade[
                 1]:
             found = True
             if found:
                 Ui.print_message(
                     "Chosen submission:\n{} {} {} {} {}\n".format(
                         sub.send_date, sub.name, sub.grade,
                         sub.github_link, sub.student_id))
                 sub_grade = Ui.get_inputs(['Grade: '], "Type the grade: ")
                 sub.grade = sub_grade[0]
                 Ui.print_message('Submission graded!')
     if not found:
         Ui.print_message('Wrong submission name or ID')
예제 #20
0
 def submit_assignment(self):
     """
     allow student to submit an assignment as a team or alone
     """
     students = Student.student_list
     Ui.print_message(
         'Choose the number from the following assignments: \n')
     for n, assignment in enumerate(Assignments.assignments_list):
         Ui.print_message(str(n + 1) + '. ' + str(assignment))
     choose = input('Type the chosen number here: ')
     assign = Assignments.assignments_list
     assignment_list = []
     choose_val = input('Type the submission link: ')
     if choose_val == '':
         Ui.print_message('Submission link is empty')
     for i in assign:
         assignment_list.append([
             datetime.date.today(), '0', i.assignment_name, choose_val,
             self.id
         ])
     if not choose.isnumeric():
         os.system('clear')
         Ui.print_message('\nChosen value must be a number')
         return
     if int(choose) <= len(assignment_list):  # value condition
         chosen_one = assignment_list[int(choose) - 1]
         for submiss in Submission.submission_list:
             if submiss.name == chosen_one[
                     2] and submiss.student_id == chosen_one[
                         4]:  # condition for assignment being submitted
                 os.system('clear')
                 Ui.print_message('Assignment is already submitted\n')
                 return
         Ui.print_message('''
         Choose the following option:\n
         (1) Submit assignment as a team
         (2) Submit assignment by myself
                     ''')
         submit_option = input('Type the number: ')
         if submit_option == '1':
             for student in students:
                 if student.team == self.team:
                     assignment_list = []
                     assignment_list.append([
                         datetime.date.today(), '0', i.assignment_name,
                         choose_val, student.id
                     ])
                     Ui.print_message(assignment_list)
                     submission_obj = Submission(chosen_one[0],
                                                 chosen_one[1],
                                                 chosen_one[2],
                                                 chosen_one[3], student.id)
                     Submission.submission_list.append(submission_obj)
         elif submit_option == '2':
             submission_obj = Submission(chosen_one[0], chosen_one[1],
                                         chosen_one[2], chosen_one[3],
                                         chosen_one[4])
             Submission.submission_list.append(submission_obj)
         else:
             Ui.print_message('Invalid value')
         os.system('clear')
         Ui.print_message('Your assignment was succesfully submitted\n')
         return Submission.submission_list
     else:
         os.system('clear')
         Ui.print_message('Invalid number')
예제 #21
0
 def add_student_to_team(cls):
     """
     change a student team
     :param person: chosen student to change a team
     """
     student_list = Student.student_list
     for student in student_list:
         Ui.print_message("""ID: {} \t {} {} ║ Actual team: {}\n""".format(
             student.id, student.name, student.surname, student.team))
     try:
         choosen_student = User.choose_person_to_change_data(student_list)
         os.system("clear")
         Ui.print_message('\nChosen student: {}'.format(choosen_student))
         teams = Student.teams_list
         for index, team in enumerate(teams):
             Ui.print_message('\n№{} {}'.format(index + 1, team))
         chosen = ''
         while chosen not in teams:
             chosen = input('\nWrite a chosen team NAME: ')
             if chosen in teams:
                 choosen_student.team = chosen
                 Ui.print_message(
                     '\nChosen student: {} join to {}! Yeah.'.format(
                         choosen_student, choosen_student.team))
                 time.sleep(3)
             else:
                 Ui.print_message('\nNo match! Try again.')
     except AttributeError:
         Ui.print_message('No student chosen.')
         time.sleep(2)
예제 #22
0
    def set_date():
        """
        :return: date of chosen day as list with strings (e.g. ["2017", "05", "03"]
        """

        while True:
            os.system("clear")
            options_list = Ui.get_inputs(["1 - Today\n2 - Choose another day\n0 - Go back\n"], "Please set a date:")
            if Common.error_integer_handling(options_list[0], 2):
                if options_list[0] == "0":
                    return None
                if options_list[0] == "1":
                    today = datetime.date.today()
                    today = str(today)
                    today_as_list = today.split("-")
                    date = today_as_list
                    return date
                if options_list[0] == "2":
                    while True:
                        os.system("clear")
                        options_list = Ui.get_inputs(
                            ["Year (e.g. 2017): ", "Month (e.g. 01): ", "Day (e.g. 23): "],
                            "Write date you want to change attendance: \n")
                        today = datetime.date.today()
                        today = str(today)
                        date = [options_list[0], options_list[1], options_list[2]]
                        if len(options_list[2]) < 2 or len(options_list[2]) > 2:
                            continue
                        if len(options_list[1]) < 2 or len(options_list[2]) > 2:
                            continue
                        if len(options_list[0]) < 4 or len(options_list[2]) > 4:
                            continue
                        if Common.error_integer_handling(options_list[0], 9999) and Common.error_integer_handling(options_list[1], 12) and Common.error_integer_handling(options_list[2], 31):
                            if options_list[1] == "02":
                                if Common.check_date(30, options_list[2]):
                                    return date
                                else:
                                    Ui.print_message("Can't accept this date.")
                                    wait = Ui.get_inputs([""], "")
                            if options_list[1] == "04":
                                if Common.check_date(30, options_list[2]):
                                    return date
                                else:
                                    Ui.print_message("Can't accept this date.")
                                    wait = Ui.get_inputs([""], "")
                            if options_list[1] == "06":
                                if Common.check_date(30, options_list[2]):
                                    return date
                                else:
                                    Ui.print_message("Can't accept this date.")
                                    wait = Ui.get_inputs([""], "")
                            if options_list[1] == "09":
                                if Common.check_date(30, options_list[2]):
                                    return date
                                else:
                                    Ui.print_message("Can't accept this date.")
                                    wait = Ui.get_inputs([""], "")
                            if options_list[1] == "11":
                                if Common.check_date(30, options_list[2]):
                                    return date
                                else:
                                    Ui.print_message("Can't accept this date.")
                                    wait = Ui.get_inputs([""], "")
                            if options_list[1] == "01" or options_list[1] == "03" or options_list[1] == "05" or options_list[1] == "07" or options_list[1] == "08" or options_list[1] == "10" or options_list[1] == "12":
                                return date
                        else:
                            Ui.print_message("Can't accept this date.")
                            wait = Ui.get_inputs([""], "")
                            continue
            else:
                 continue
예제 #23
0
    def add_an_assignment(cls):
        """
        method adds assignments to assignment_list, and update this list
        """
        os.system('clear')
        while True:
            data = Ui.get_inputs([
                'Start date\n\tday(1-31): ', '\tmonth(1-12): ',
                '\tyear(2000+): ', 'End date\n\tday(1-31): ',
                '\tmonth(1-12): ', '\tyear(2000+): ', 'Assignment name\n\t'
            ], "Please provide the assignment details: \n")
            try:
                start_date_day = int(data[0])
                start_date_month = int(data[1])
                start_date_year = int(data[2])
                end_date_day = int(data[3])
                end_date_month = int(data[4])
                end_date_year = int(data[5])
                name_of_assign = str(data[6])
            except ValueError:
                Ui.print_message("\nDate must be an integer!\n\n")
                break

            if start_date_day > 31 or start_date_day < 1:
                Ui.print_message('\nStart day value is incorrect')
            else:
                if start_date_month > 12 or start_date_month < 1:
                    Ui.print_message('\nStart month value is incorrect')
                else:
                    if start_date_year > 9999 or start_date_year < 2000:
                        Ui.print_message('\nStart year value is incorrect')
                    else:
                        if end_date_day > 31 or end_date_day < 1:
                            Ui.print_message('\nEnd day value is incorrect')
                        else:
                            if end_date_month > 12 or end_date_month < 1:
                                Ui.print_message(
                                    '\nEnd month value is incorrect')
                            else:
                                if end_date_year > 9999 or end_date_year < 1000:
                                    Ui.print_message(
                                        '\nEnd year value is incorrect')
                                else:
                                    if len(name_of_assign) <= 1:
                                        Ui.print_message(
                                            "\nAssignment name have to be longer!"
                                        )
                                    else:
                                        list_of_names_of_assignments = []
                                        for i in Assignments.assignments_list:
                                            list_of_names_of_assignments.append(
                                                i.assignment_name)
                                        if name_of_assign in list_of_names_of_assignments:
                                            Ui.print_message(
                                                "\nAssignment name already exist, "
                                                "type another one!")
                                        else:
                                            start_date = '{}-{}-{}'.format(
                                                start_date_year,
                                                start_date_month,
                                                start_date_day)
                                            end_date = '{}-{}-{}'.format(
                                                end_date_year, end_date_month,
                                                end_date_day)
                                            new_assignment = cls(
                                                start_date, end_date,
                                                name_of_assign)
                                            Assignments.assignments_list.append(
                                                new_assignment)
                                            Ui.print_message(
                                                "\nAssignment added!\n")
                                            Ui.get_inputs(
                                                [''], "Click enter to go back")
            break  # it stops the WHILE loop whenever passed information is incorrect, or assignment has been added
예제 #24
0
    def handle_menu(user):
        '''
        Allows to choose an action to perform.
        '''
        options = ["View regular employees list",
                   "Add an employee",
                   "Edit employees' data",
                   "Fire an employee",
                   "View mentors list",
                   'Show the full statistics about mentors',
                   "Add a mentor",
                   "Edit mentors' data",
                   "Fire a mentor",
                   "View students list",
                   "View students' grades",
                   'Show full statistics about students']

        while True:
            os.system('clear')
            Ui.print_message(('\n...:::Logged in as {}:::...\n').format(user))
            Ui.print_menu("What you want to do?", options, "Log out")
            inputs = Ui.get_inputs(["Please enter a number: "], "")
            option = inputs[0]

            if option == '1':
                ManagerMenu.show_regular_employees()
                Ui.get_inputs([''], "Click enter to go back")

            elif option == '2':
                Employee.add_person(Employee.employees_list)
                Common.write_staff_to_file('database.db', Employee.employees_list)

            elif option == '3':
                # change regular employee's data
                ManagerMenu.show_regular_employees()
                person = Employee.choose_person_to_change_data(Employee.employees_list)
                if person:
                    Employee.data_to_change(person)
                    Common.write_staff_to_file('database.db', Employee.employees_list)

            elif option == '4':
                ManagerMenu.show_regular_employees()
                Employee.remove_person(Employee.employees_list)

            elif option == '5':
                ManagerMenu.show_mentors()
                Ui.get_inputs([''], "Click enter to go back")

            elif option == '6':
                #  Show full statistics about mentors
                ManagerMenu.show_mentors()
                Ui.get_inputs([''], "Click enter to go back")

            elif option == '7':
                Mentor.add_person(Mentor.mentors_list)
                Common.write_staff_to_file('database.db', Mentor.mentors_list)

            elif option == '8':
                # change mentor's data
                ManagerMenu.show_mentors()
                person = Mentor.choose_person_to_change_data(Mentor.mentors_list)
                if person:
                    Mentor.data_to_change(person)
                    Common.write_staff_to_file('database.db', Mentor.mentors_list)

            elif option == '9':
                # fire mentor
                ManagerMenu.show_mentors()
                Mentor.remove_person(Mentor.mentors_list)
                Common.write_staff_to_file('database.db', Mentor.mentors_list)

            elif option == '10':
                ManagerMenu.show_students()

            elif option == '11':
                ManagerMenu.show_average_of_grades()
                Ui.get_inputs([''], "Click enter to go back")

            elif option == '12':
                ManagerMenu.show_full_statistics_about_students()
                Ui.get_inputs([''], "Click enter to go back")

            elif option == '0':
                ManagerMenu.save()
                sys.exit()
            else:
                Ui.print_error_message('There is no such option.')
예제 #25
0
    def handle_menu(user):
        """
        It doesnt return anything, just handle menu for mentor
        """
        list_options = ['Check the list of students',
                        'Add an assignment',
                        'Grade an assignment submitted by students',
                        'Check attendance of students',
                        'Add a student to a class',
                        'Remove a student from class',
                        "Edit student's data",
                        'Show students of specific group',
                        'Give a card to student',
                        'Add student to specific group',
                        'Show full report of students performance between provided dates',
                        'Add a team']

        while True:
            os.system('clear')
            Ui.print_message(('\n...:::Logged in as {}:::...\n').format(user))
            Ui.print_menu("What you want to do?", list_options, 'Log out')

            chose_option = Ui.get_inputs(["Please enter a number: "], "")

            if chose_option[0] == '1':
                # print list of students
                MentorMenu.show_students_data()
                Ui.get_inputs([''], "Click enter to go back")

            elif chose_option[0] == '2':
                # add an assignment to assignment list
                Assignments.add_an_assignment()
                Common.write_assignment_to_db('database.db', Assignments.assignments_list)

            elif chose_option[0] == '3':
                # grade assignments submitted by students
                Submission.grade_an_submission()
                Common.write_submission_to_db('database.db', Submission.submission_list)

            elif chose_option[0] == '4':
                # check attendance of students
                Attendance.attendance_mini_menu()
                Common.write_attendance_to_db('database.db', Attendance.attendances_list)

            elif chose_option[0] == '5':
                # add a student to a class
                Student.add_person(Student.student_list)
                Common.write_student_to_db('database.db', Student.student_list)

            elif chose_option[0] == '6':
                # remove student from class
                ManagerMenu.show_students()
                Student.remove_person(Student.student_list)
                Common.write_student_to_db('database.db', Student.student_list)

            elif chose_option[0] == '7':
                # edit students data
                ManagerMenu.show_students()
                person = Student.choose_person_to_change_data(Student.student_list)
                if person:
                    Employee.data_to_change(person)
                    Common.write_student_to_db('database.db', Student.student_list)

            elif chose_option[0] == '8':
                # show students of specific group
                stu_list = Student.student_list
                Ui.print_student_teams(stu_list)
                Ui.get_inputs([''], "Click enter to go back")

            elif chose_option[0] == '9':
                # give a card to students
                MentorMenu.show_students_data()
                person = Student.choose_person_to_change_data(Student.student_list)
                if person:
                    Student.change_student_card(person)
                    Common.write_student_to_db('database.db', Student.student_list)

            elif chose_option[0] == '10':
                # add student to specific team
                os.system('clear')
                Student.add_student_to_team()
                Common.write_student_to_db('database.db', Student.student_list)

            elif chose_option[0] == '11':
                # Show full report of students performance between provided dates
                Student.show_full_report_of_students_performance()

            elif chose_option[0] == '12':
                # Add a new team
                Student.add_team()
                Common.write_team_to_db('database.db', Student.teams_list)

            elif chose_option[0] == '0':
                sys.exit()

            else:
                Ui.print_message('There is no such option.')
예제 #26
0
 def change_student_card(cls, person):
     """
     change a student card
     :param person: chosen student to change a card
     """
     os.system('clear')
     Ui.print_message("Chosen student: {} {}".format(person, person.card))
     Ui.print_message("What card you want to give:\n"
                      "1. GREEN\n"
                      "2. YELLOW\n"
                      "3. RED\n"
                      "4. None")
     chose_card = Ui.get_inputs([''], "")
     while True:
         if chose_card[0] == '1':
             person.card = "Green"
             Ui.print_message("Card has been added!")
             Ui.get_inputs([''], "Click enter to go back")
             break
         elif chose_card[0] == '2':
             person.card = "Yellow"
             Ui.print_message("Card has been added!")
             Ui.get_inputs([''], "Click enter to go back")
             break
         elif chose_card[0] == '3':
             person.card = "Red"
             Ui.print_message("Card has been added!")
             Ui.get_inputs([''], "Click enter to go back")
             break
         elif chose_card[0] == '4':
             person.card = "None"
             Ui.print_message("Card has been added!")
             Ui.get_inputs([''], "Click enter to go back")
             break
         else:
             Ui.print_message('Wrong input!')