mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Remove unnecessary deletes which hare handled by cascade options
This commit is contained in:
		@@ -241,10 +241,7 @@ class User(UserMixin, db.Model):
 | 
				
			|||||||
        '''
 | 
					        '''
 | 
				
			||||||
        Delete the user and its corpora and jobs from database and filesystem.
 | 
					        Delete the user and its corpora and jobs from database and filesystem.
 | 
				
			||||||
        '''
 | 
					        '''
 | 
				
			||||||
        for job in self.jobs:
 | 
					
 | 
				
			||||||
            job.delete()
 | 
					 | 
				
			||||||
        for corpus in self.corpora:
 | 
					 | 
				
			||||||
            corpus.delete()
 | 
					 | 
				
			||||||
        db.session.delete(self)
 | 
					        db.session.delete(self)
 | 
				
			||||||
        db.session.commit()
 | 
					        db.session.commit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -365,10 +362,7 @@ class Job(db.Model):
 | 
				
			|||||||
        '''
 | 
					        '''
 | 
				
			||||||
        Delete the job and its inputs and results from the database.
 | 
					        Delete the job and its inputs and results from the database.
 | 
				
			||||||
        '''
 | 
					        '''
 | 
				
			||||||
        for input in self.inputs:
 | 
					
 | 
				
			||||||
            db.session.delete(input)
 | 
					 | 
				
			||||||
        for result in self.results:
 | 
					 | 
				
			||||||
            db.session.delete(result) # TODO: shouldn't this happen through the cascade option?
 | 
					 | 
				
			||||||
        db.session.delete(self)
 | 
					        db.session.delete(self)
 | 
				
			||||||
        db.session.commit()
 | 
					        db.session.commit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -528,8 +522,6 @@ class Corpus(db.Model):
 | 
				
			|||||||
                'files': {file.id: file.to_dict() for file in self.files}}
 | 
					                'files': {file.id: file.to_dict() for file in self.files}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def delete(self):
 | 
					    def delete(self):
 | 
				
			||||||
        for corpus_file in self.files:
 | 
					 | 
				
			||||||
            db.session.delete(corpus_file)
 | 
					 | 
				
			||||||
        db.session.delete(self)
 | 
					        db.session.delete(self)
 | 
				
			||||||
        db.session.commit()
 | 
					        db.session.commit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user