Ejemplo n.º 1
0
    def DisciplineH(self):

        top = tk.Toplevel()
        top.title('Enrollment List')
        top.text = Listbox(top)
        top.text.grid(row=0, column=0)
        top.text.config(width=50)

        sList = [['', '']]
        gList = []
        dName = ''
        for discipline in self._disciplineControl.getCurentRepo(
        ).getDisciplines():
            for grade in self._gradeControl.getCurentRepo().getGrades():
                if discipline.getId() == grade.getDisciplineID():
                    if (grade.getGrade() != []):
                        gAvg = self.listAvg(grade.getGrade(),
                                            grade.getGradeSize())
                        gList.append(gAvg)
                        dName = discipline.getName()
            if gList != []:
                sAvg = self.listAvg(gList, len(gList))
                sList.append([dName, round(sAvg, 2)])

        sList.sort(key=itemgetter(1), reverse=True)

        for index in range(1, len(sList)):
            top.text.insert(
                END,
                '\n' + str(sList[index][0]) + ' - ' + str(sList[index][1]))
        del sList[:]
Ejemplo n.º 2
0
    def StudentEnrollB(self):

        try:
            top = tk.Toplevel()
            top.title('Enrollment List')
            top.text = Listbox(top)
            top.text.grid(row=0, column=0)

            index = self.dList.curselection()
            disciplineID = self.DreadID(self.dList.get(index))
            disciplineID = int(disciplineID)

            SList = [[' ', -1]]
            for grade in self._gradeControl.getCurentRepo().getGrades():
                if grade.getDisciplineID() == disciplineID:
                    for student in self._studentControl.getCurentRepo(
                    ).getStudents():
                        if student.getId() == grade.getStudentID():
                            if grade.getGrade() != []:
                                gradeAvg = self.listAvg(
                                    grade.getGrade(), grade.getGradeSize())
                                SList.append([student.getName(), gradeAvg])

            SList.sort(key=itemgetter(1), reverse=True)
            del SList[-1]
            for index in SList:
                top.text.insert(END, index)
            del SList[:]

        except TclError:
            top.destroy()
            self.displayError('No disicpline Selected')
Ejemplo n.º 3
0
    def FailingStudents(self):

        top = tk.Toplevel()
        top.title('Enrollment List')
        top.text = Listbox(top)
        top.text.grid(row=0, column=0)
        top.text.config(width=50)

        sList = [['', '']]
        for grade in self._gradeControl.getCurentRepo().getGrades():
            for student in self._studentControl.getCurentRepo().getStudents():
                for discipline in self._disciplineControl.getCurentRepo(
                ).getDisciplines():
                    if grade.getStudentID() == student.getId():
                        if grade.getDisciplineID() == discipline.getId():
                            if grade.getGrade() != []:
                                gradeAvg = self.listAvg(
                                    grade.getGrade(), grade.getGradeSize())
                                if gradeAvg < 5:
                                    sList.append([
                                        student.getName(),
                                        discipline.getName()
                                    ])

        for index in sList:
            top.text.insert(END, '\n' + index[0] + ' - ' + index[1])
        del sList[:]
Ejemplo n.º 4
0
 def searchDiscipline(self, disciplineID):
     '''
     Funtion to find a discipline ID in the list
     :param: disciplineID - id to searh for
     '''
     for grade in self._grades:
         if grade.getDisciplineID() == disciplineID:
             return grade
     raise classException('Discipline not found')
Ejemplo n.º 5
0
    def searchGrade(self, grade):
        '''
        Function to find a grade in the list
        :param: grade - grade to search for
        '''

        for grades in self._grades:
            if grades.getDisciplineID() == grade.getDisciplineID(
            ) and grades.getStudentID() == grade.getStudentID():
                return grade
        raise classException('Grade not found')
Ejemplo n.º 6
0
    def remove_Discipline(self):
        try:
            index = self.dList.curselection()
            disciplineID = self.DreadID(self.dList.get(index))
            disciplineID = int(disciplineID)

            name = ''
            eList = []
            gList = []

            for Discipline in self._disciplineControl.getCurentRepo(
            ).getDisciplines():
                if int(Discipline.getId()) == disciplineID:
                    name = Discipline.getName()

            for enroll in self._enrolControl.getCurentRepo().getEnroll():
                if enroll.get_discipline_id() == disciplineID:
                    eList.append(enroll)

            for grade in self._gradeControl.getCurentRepo().getGrades():
                if grade.getDisciplineID() == disciplineID:
                    gList.append(grade)

            try:
                self._disciplineControl.removeDiscipline(disciplineID)
            except classException:
                pass
            try:
                self._gradeControl.removeGradeDiscipline(disciplineID)
            except classException:
                pass

            try:
                self._enrolControl.removeEnrollDiscipline(disciplineID)
            except classException:
                pass

            try:
                self._disciplineControl.delete(disciplineID, eList, gList,
                                               name)
            except classException:
                pass

            self.refreshALL()

        except ValueError:
            self.displayError('Invalid Input')

        except NameError:
            self.displayError('Invalid Name')

        except TclError:
            self.displayError('No item selected')
Ejemplo n.º 7
0
 def removeLastGrade(self, grade):
     '''
     Funtcion to remove he last grade from a lis tof grades
     :param: grade - grade instance
     '''
     try:
         for grades in self._grades:
             if grades.getDisciplineID() == grade.getDisciplineID(
             ) and grades.getStudentID() == grade.getStudentID():
                 grades.getGrade().pop()
                 return
     except classException:
         raise ValueError("Student was not graded")
Ejemplo n.º 8
0
 def updateGradeDisciplineID(self, disciplineID, newID):
     '''
     Funtion to update a discipline ID in the grade list
     :param: disciplineID - the discipline ID to be updated
     :param: newName - the new name
     '''
     while True:
         try:
             self.searchDiscipline(disciplineID)
             for grade in self._grades:
                 if grade.getDisciplineID() == disciplineID:
                     grade.setDisciplieID(newID)
         except classException:
             break
Ejemplo n.º 9
0
 def addGrade(self, grade, gradeValue):
     '''
     Function to add a new grade
     :param: grade - grade to be added
     :param: gradeValue - grade value to be added
     '''
     try:
         for grades in self._grades:
             if grades.getDisciplineID() == grade.getDisciplineID(
             ) and grades.getStudentID() == grade.getStudentID():
                 grades.addGrade(gradeValue)
                 return
         self._grades.append(grade)
         self.addGrade(grade, gradeValue)
     except classException:
         raise ValueError("Student was not graded")
Ejemplo n.º 10
0
 def statFailing(self):
     sList = [['','']]
     for grade in self._gradeControl.getCurentRepo().getGrades():
         for student in self._studentControl.getCurentRepo().getStudents():
             for discipline in self._disciplineControl.getCurentRepo().getDisciplines():
                 if grade.getStudentID() == student.getId():
                     if grade.getDisciplineID() == discipline.getId():
                         if grade.getGrade() != []:
                             gradeAvg = self.listAvg(grade.getGrade(),grade.getGradeSize())
                             if gradeAvg < 5:
                                 sList.append([student.getName(),discipline.getName()])
     
     print '\n'
     for index in sList:
         print index[0],' - ',index[1]
     del sList[:]
Ejemplo n.º 11
0
 def statDiscipline(self):
     sList =[['','']]
     gList =[]
     dName = ''
     for discipline in self._disciplineControl.getCurentRepo().getDisciplines():
         for grade in self._gradeControl.getCurentRepo().getGrades():
             if discipline.getId() == grade.getDisciplineID():
                 if(grade.getGrade() != []):
                     gAvg = self.listAvg(grade.getGrade(), grade.getGradeSize())
                     gList.append(gAvg)
                     dName = discipline.getName()
         if gList != []:
             sAvg = self.listAvg(gList, len(gList))
             sList.append([dName,round(sAvg,2)])
         
     sList.sort(key=itemgetter(1),reverse = True)
     print '\n'
     for index in range(1,len(sList)):
         print sList[index][0],' - ',sList[index][1]
     del sList[:]
Ejemplo n.º 12
0
 def statEnroll(self):
     disciplineID =int(input('\nEnter discipline ID:'))
     print '\n1). Sort alphabetically'
     print '2). Sort by grade'
     option = input('Enter Option:')
     if option != 1 and option != 2:
         print 'Option invalid'
         return
     
     elif option == 1:
         sList = []
         for enroll in self._enrolControl.getCurentRepo().getEnroll():
             if enroll.get_discipline_id() == disciplineID:
                 sList.append(enroll.get_student_id())
         
         for index in range(len(sList)):
             for student in self._studentControl.getCurentRepo().getStudents():
                 if sList[index] == student.getId():
                     sList[index] = student.getName()
         
         sList.sort()
         print '\n' 
         for index in sList:
             print index
         del sList[:]
     
     elif option == 2:
         sList = [[' ',-1]]
         for grade in self._gradeControl.getCurentRepo().getGrades():
             if grade.getDisciplineID() == disciplineID:
                 for student in self._studentControl.getCurentRepo().getStudents():
                     if student.getId() == grade.getStudentID():
                         if grade.getGrade() != []:
                             gradeAvg = self.listAvg(grade.getGrade(),grade.getGradeSize())
                             sList.append([student.getName(),gradeAvg])
         
         sList.sort(key=itemgetter(1),reverse = True)
         print '\n'
         for index in range(len(sList)-1):
             print sList[index]
         del sList[:]