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[:]
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[:]
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')
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[:]
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[:]
def statBest(self): sList =[['','']] gList =[] sName = '' for student in self._studentControl.getCurentRepo().getStudents(): for grade in self._gradeControl.getCurentRepo().getGrades(): if student.getId() == grade.getStudentID(): if(grade.getGrade() != []): gAvg = self.listAvg(grade.getGrade(), grade.getGradeSize()) gList.append(gAvg) sName = student.getName() if gList != []: sAvg = self.listAvg(gList, len(gList)) sList.append([sName,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[:]
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[:]