h.body můžou být i None
This commit is contained in:
		
							parent
							
								
									d1daefb1ba
								
							
						
					
					
						commit
						ea3050c509
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -312,7 +312,7 @@ class Resitel(SeminarModelBase): | ||||||
| 		vsechna_reseni = self.reseni_set.all() | 		vsechna_reseni = self.reseni_set.all() | ||||||
| 		vsechna_hodnoceni = Hodnoceni.objects.filter( | 		vsechna_hodnoceni = Hodnoceni.objects.filter( | ||||||
| 			reseni__in=vsechna_reseni) | 			reseni__in=vsechna_reseni) | ||||||
| 		return sum(h.body for h in list(vsechna_hodnoceni)) | 		return sum(h.body for h in list(vsechna_hodnoceni) if h is not None) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	def get_titul(self, body=None): | 	def get_titul(self, body=None): | ||||||
|  | @ -360,7 +360,7 @@ class Resitel(SeminarModelBase): | ||||||
| 		novejsi_hodnoceni = Hodnoceni.objects.filter(reseni__in=self.reseni_set.all()).difference(hodnoceni_do_25_rocniku) | 		novejsi_hodnoceni = Hodnoceni.objects.filter(reseni__in=self.reseni_set.all()).difference(hodnoceni_do_25_rocniku) | ||||||
| 
 | 
 | ||||||
| 		def body_z_hodnoceni(hh : list): | 		def body_z_hodnoceni(hh : list): | ||||||
| 			return sum(h.body for h in hh) | 			return sum(h.body for h in hh if h is not None) | ||||||
| 
 | 
 | ||||||
| 		stare_body = body_z_hodnoceni(hodnoceni_do_25_rocniku) | 		stare_body = body_z_hodnoceni(hodnoceni_do_25_rocniku) | ||||||
| 		if body is None: | 		if body is None: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Jonas Havelka
						Jonas Havelka