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 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.º 4
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.º 5
0
def main():
    a = Assignments()
    a.prompt()
    a.display()
    d = Date()
Exemplo n.º 6
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.º 7
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: