def find_student(self, Id): ''' Find a student based on its Id, and returns its characteristics ''' try: return self.__rep.find(Id) except ValidatorError as ve: raise StoreError(ex=ve) except RepositoryError as re: raise StoreError(ex=re)
def delete_student(self, Id): ''' Deletes a student and its characteristics ''' try: self.__rep.delete(Id) except ValidatorError as ve: raise StoreError(ex=ve) except RepositoryError as re: raise StoreError(ex=re)
def add_student(self, Id, name, group): ''' add a student ''' s = Student(Id, name, group) try: self.__rep.save(s) except ValidatorError as ve: raise StoreError(ex=ve) except RepositoryError as re: raise StoreError(ex=re)
def add_Laboratory(self, number, description, deadline): ''' Adds a new laboratory assignment ''' l = Laboratory(number, description, deadline) try: self.__rep.save(l) except ValidatorError as ve: raise StoreError(ex=ve) except RepositoryError as re: raise StoreError(ex=re)
def findLab(self): Nr = int(input("Give the number of lab: ")) try: l = self.__controllerL.find_lab(Nr) print(l) except StoreError as ve: raise StoreError(ex=ve)
def FindStudent(self): Id = int(input("Give id: ")) try: s = self.__controllerS.find_student(Id) print(s) except StoreError as ve: raise StoreError(ex=ve)
def DeleteLab(self): Id = int(input("Give the number of lab:")) try: self.__controllerL.delete_Laboratory(Id) self.PrintAllLaboratories() except StoreError as ve: raise StoreError(ex=ve)
def DeleteStudent(self): Id = int(input("Give id:")) try: self.__controllerS.delete_student(Id) self.PrintAllStudents() except StoreError as ve: raise StoreError(ex=ve)
def associate(self, Id, number, Grade): ''' Assigns to every student a laboratory Input - id (integer) - number (integer) - the number of laboratory - grade (float) - the grade for the assignment ''' try: stud = self.__repoS.find(Id) lab = self.__repoL.find(number) n = Grade(stud, lab, Grade) self.__repoG.save(n) except ValidatorError as ve: raise StoreError(ex=ve) except RepositoryError as re: raise StoreError(ex=re) return n
def UpdateStudent(self): Id = int(input("Give id: ")) name = input("Give name: ") group = int(input("Give group:")) try: self.__controllerS.update_student(Id, name, group) self.PrintAllStudent() except StoreError as ve: raise StoreError(ex=ve)
def PrintLab(self, Id): Id = int(input("Give the number of the Laboratory: ")) description = input("Give a description ") deadline = input("Give deadline: ") try: self.__controllerL.add_Laboratory(Id, description, deadline) print("Laboratory was successfully added.") except StoreError as ve: raise StoreError(ex=ve)
def PrintStud(self, Id): Id = int(input("Give id: ")) name = input("Give name: ") group = int(input("Give group: ")) try: self.__controllerS.add_student(Id, name, group) print(name, "was successfully added.") except StoreError as ve: raise StoreError(ex=ve)
def UpdateLaboratory(self): Id = int(input("Give id: ")) description = input("Give description: ") deadline = input("Give deadline:") try: self.__controllerL.update_lab(Id, description, deadline) self.PrintAllLaboratories() except StoreError as ve: raise StoreError(ex=ve)
def PrintGrades(self): Id = int(input("Give id student:")) Nr = int(input("Give the number of assignment:")) grade = int(input("Give grade:")) try: self.__controllerG.associate(Id, Nr, grade) print(self.__controllerS.find_student(Id), "has grade ", grade, " for laboratory number ", Nr) except StoreError as ve: raise StoreError(ex=ve)