Beispiel #1
0
    def updateLaborator(self, nrlab, nrprb, descriere, deadline):
        lab = Laborator(nrlab, nrprb, descriere, deadline)
        list = self.__repoNota.get_all_note()
        for x in list:
            if x.get_laborator() == lab:
                self.__repoNota.update_nota_laborator(lab)

        self.__repoLaborator.update_laborator(lab)
Beispiel #2
0
    def deleteLaborator(self, nrlab, nrprb):
        lab = Laborator(nrlab, nrprb, "descriere", "zz.ll.aaaa")
        list = self.__repoNota.get_all_note()
        for x in list:
            if x.get_laborator() == lab:
                self.__repoNota.delete_nota(lab)

        self.__repoLaborator.delete_laborator(lab)
Beispiel #3
0
def TestSearchById():
    lab = Laborator(1,2,"strings", "22.10.2015")
    repoLab = RepoLaborator()
    repoLab.store_laboratoare(lab)
    assert repoLab.searchById(1, 2) == lab
    
    try:
        repoLab.searchById(1,1)
        assert False
    except RepoError as ve:
        assert str(ve) == "Nu s-a gasit lab!"
Beispiel #4
0
    def statistica1(self, nrlab, nrprb):
        lab = Laborator(nrlab, nrprb, "bla", "10.10.2010")
        lista_studenticunote = []
        list = self.getAllNote()
        for x in list:
            if x.get_laborator() == lab:
                lista_studenticunote.append((x.get_student(), x.get_mark()))

        #lista_studenticunote.sort(key = lambda x: x[0].get_nume())
        lista_studenticunote = sortMeuInsertion(lista_studenticunote[:],
                                                key=lambda x: x[0].get_nume())
        return lista_studenticunote
Beispiel #5
0
 def __loadFromFile(self):
     try:
         f = open(self.__fName, "r")
         line = f.readline().strip()
         while line != "":
             attrs = line.split(";")
             lab = Laborator(attrs[0], attrs[1], attrs[2], attrs[3])
             RepoLaborator.store_laboratoare(self, lab)
             line = f.readline().strip()
     except IOError:
         raise FileRepoError()
     finally:
         f.close()
Beispiel #6
0
def TestDelNota():
    repoNota = RepoNota()
    st = Student(2, "mihai", 215)
    lab = Laborator(2, 2, "mihai", "22.10.2015")
    nota = Nota(2, st, lab)
    repoNota.store_note(nota)
    
    l = repoNota.get_all_note()
    assert len(l) == 1
    
    repoNota.delete_nota(st)
    
    l = repoNota.get_all_note()
    assert len(l) == 0
Beispiel #7
0
    def get_all_laboratoare(self):
        labs = []
        try:
            f = open(self.__fName, "r")
            line = f.readline().strip()
            while line != "":
                attrs = line.split(";")
                lab = Laborator(attrs[0], attrs[1], attrs[2], attrs[3])
                labs.append(lab)
                line = f.readline().strip()
        except IOError:
            raise FileRepoError()
        finally:
            f.close()

        return labs
Beispiel #8
0
def testAddNota():
    repoNota = RepoNota()
    repoStudent = RepoStudent()
    repoLaborator = RepoLaborator()
    validNota = NotaValidator()
    validStudent = StudentValidator()

    servNota = ServiceNota(validNota, repoNota, repoStudent, repoLaborator)
    student = Student(12, "Mihai", 215)
    lab = Laborator(1, 2, "strings", "22.10.2015")
    repoStudent.store_studenti(student)
    repoLaborator.store_laboratoare(lab)
    servNota.addNota(12, 1, 2, 10)
    lista = repoNota.get_all_note()
    assert len(lista) == 1

    servStudent = ServiceStudent(repoStudent, validStudent)
    servNota.deleteStudent(12)
    list = repoStudent.get_all_studenti()
    assert len(list) == 0
Beispiel #9
0
 def addLaborator(self, nrlab, nrpb, descriere, deadline):
     lab = Laborator(nrlab, nrpb, descriere, deadline)
     self.__validLaborator.valideazaLaborator(lab)
     self.__repoLaborator.store_laboratoare(lab)