Exemplo n.º 1
0
    def test_task1(self):
        costs = np.array([[2, -1, 9, 4], [3, 2, 5, 1], [13, 0, -3, 4],
                          [5, 6, 1, 2]])

        assignment = Assignments()
        ans, cost = assignment.solve(costs)

        self.assertEqual(cost, 1)
        self.assertListEqual(ans, [1, 0, 2, 3])
Exemplo n.º 2
0
    def test_task2(self):
        costs = np.array([[6, 4, 13, 4, 19, 15, 11, 8],
                          [17, 15, 18, 14, 0, 7, 18, 7],
                          [3, 5, 11, 9, 7, 7, 18, 16],
                          [17, 10, 16, 19, 9, 6, 1, 5],
                          [14, 2, 10, 14, 11, 6, 4, 10],
                          [17, 11, 17, 12, 1, 10, 6, 19],
                          [13, 1, 4, 2, 2, 7, 2, 14],
                          [12, 15, 19, 11, 13, 1, 7, 8]])

        assignment = Assignments()
        ans, cost = assignment.solve(costs)

        self.assertEqual(cost, 23)
        self.assertListEqual(ans, [3, 7, 0, 6, 1, 4, 2, 5])
Exemplo n.º 3
0
 def loading_data():
     '''
     Creates objects from DB and then a list of all users to loop through for login and password validation.
     '''
     Assignments.assignments_list = Assignments.create_objects_list_from_database('assignements')
     Attendance.attendances_list = Attendance.create_objects_list_from_database('attendance')
     Submission.create_objects_list_from_database('submission')
     Student.add_attendance_to_student(Attendance.attendances_list) # add attendance obj to a specific student
     Student.create_teams_list()
Exemplo n.º 4
0
    def saveAssignment(self,
                       assignmentName,
                       courseName,
                       assignmentType,
                       entries,
                       studentName='') -> None:
        '''
        Saves an assignment to the database

        Calls on the Assignment class to save assignment marks and weightings

        Parameters
        ----------
        assignmentName : str
            Name of the assignment
        courseName : str
            Name of the course
        assignmentType : str
            Type of assignment
        entires : dict
            Marks and weightings entered into the assignment
        studentName : str
            Name of the student who the assignment belongs to, if applicable

        Returns
        -------
        None

        Raises
        -------
        AttributeError
            If the MainScreen object (self) does not have a categoryManageBtn attribute

        '''
        saveMessage = Assignments(self.currentAccount, courseName, entries,
                                  studentName).save(assignmentType)
        try:
            self.categoryManageBtn.destroy()
        except:
            pass
        self.assignmentClicked(assignmentName, courseName, assignmentType,
                               studentName)
        self.saveStatus.config(text=saveMessage)
Exemplo n.º 5
0
    def __init__(self, username, courseName, studentName):
        '''
        Constructor to build a Marks object

        Parameters
        ----------
        username : str
            Account username
        courseName : str
            Name of the course
        studentName : str
            Name of the student
        
        Raises
        -------
        KeyError
            If a document in 'GradebookStudents' does not have an 'assignments' key
        KeyError
            If an 'assignment' array item in a document in 'GradebookStudents' does not have an 'adjusted weighintg' key
        '''

        self.username = username
        self.courseName = courseName
        self.studentName = studentName
        self.assignmentList = []
        try:
            studentAssignments = Courses(self.username).docGet(
                {
                    'student name': studentName,
                    'course name': self.courseName
                }, 'GradebookStudents')['assignments']
            for assignment in studentAssignments:
                try:
                    self.assignmentList.append(
                        AssignmentsAdjusted(self.username, self.courseName,
                                            assignment, self.studentName,
                                            assignment['adjusted weighting']))
                except:
                    self.assignmentList.append(
                        Assignments(self.username, self.courseName, assignment,
                                    self.studentName))
        except:
            pass
Exemplo n.º 6
0
def main():
    a = Assignments()
    a.prompt()
    a.display()
    d = Date()
Exemplo n.º 7
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.')
Exemplo n.º 8
0
    def test_task3(self):
        costs = np.array([[5, 0, 7, 3], [11, 0, 10, 4], [0, 2, 3, 2],
                          [1, 3, 0, 5]])

        assignment = Assignments()
        _, _ = assignment.solve(costs)
Exemplo n.º 9
0
if len(sys.argv) == 1:
    exit(1)

if sys.argv[1] == '-c' or sys.argv[1] == '--courses':
    c = Courses()
    c.show_courses()
elif sys.argv[1] == '-g' or sys.argv[1] == '--grade':
    c = Grades()
    x = sys.argv[2]
    c.show_grades(x)
elif sys.argv[1] == '-q' or sys.argv[1] == '--quiz':
    c = Quizzes()
    x = sys.argv[2]
    c.show_quizzes(x)
elif sys.argv[1] == '-a' or sys.argv[1] == '--assignment':
    c = Assignments()
    if len(sys.argv) == 2:
        c.show_all_assignments()
    elif len(sys.argv) == 3 and sys.argv[2] == '-due':
        c.show_all_due_assignments()
elif sys.argv[1] == '-f' or sys.argv[1] == '--forum':
    c = discussion_forums()
    if len(sys.argv) == 3:
        c.show_course_discussion_forums(sys.argv[2])
    elif len(sys.argv) == 4:
        c.show_course_discussion_forums(sys.argv[2], sys.argv[3])
elif sys.argv[1] == '-d' or sys.argv[1] == '--discussion':
    c = Discussions()
    if len(sys.argv) == 3:
        c.show_discussions_from_a_forum(sys.argv[2])
    elif len(sys.argv) == 4: