def createProjectDict(self): """Creates the dictionary projectDict that uses the names of the projects as keys and their ids as values. Only the projects currently available on the database are added to projectDict. """ server = Server() table = server.getTable("projects") self.projectIds = [project[0] for project in table] self.projectNames = [project[1] for project in table] self.projectDict = dict(zip(self.projectNames, self.projectIds))
def checkProjectExist(self) -> bool: """Checks if the name is used by another project.""" server = Server() projects = [project[1] for project in server.getTable("projects")] return self.name.text() not in projects