Uprava pocitani rocniku resitele (z rocniku misto data)
This commit is contained in:
		
							parent
							
								
									35d9f0ccd1
								
							
						
					
					
						commit
						3c1db85895
					
				
					 2 changed files with 10 additions and 10 deletions
				
			
		|  | @ -210,16 +210,16 @@ class Resitel(SeminarModelBase): | |||
|                 'school-name': str(self.skola) if self.skola else 'Skola neni znama', | ||||
|             } | ||||
| 
 | ||||
|     def rocnik(self, datum): | ||||
| 		"""Vypise skolni rocnik resitele pro zadane datum typu datetime. | ||||
|                 Vraci None pro neznamy rocnik.""" | ||||
|     def rocnik(self, rocnik): | ||||
| 		"""Vrati skolni rocnik resitele pro zadany Rocnik. | ||||
|                 Vraci '' pro neznamy rok maturity resitele, Z* pro ekvivalent ZŠ.""" | ||||
|                 if self.rok_maturity is None: | ||||
|                     return None | ||||
| 		rozdil = self.rok_maturity - datum.year | ||||
| 		if datum.month < 9: | ||||
| 			return 4 - rozdil | ||||
|                     return '' | ||||
| 		rozdil = 5 - (self.rok_maturity - rocnik.prvni_rok) | ||||
|                 if rozdil >= 1: | ||||
|                     return str(rozdil) | ||||
|                 else: | ||||
| 			return 5 - rozdil | ||||
|                     return 'Z' + str(rozdil + 9) | ||||
| 
 | ||||
|     def titul(self, celkove_body): | ||||
| 		"Vrati titul podle zadaneho poctu bodu." | ||||
|  |  | |||
|  | @ -96,7 +96,7 @@ class CisloView(generic.DetailView): | |||
|             v = vysledky[vi] | ||||
|             tv = RadekVysledkovky() | ||||
|             tv.resitel = v.resitel   | ||||
|             tv.rocnik = tv.resitel.rocnik(context['cislo'].datum_vydani) | ||||
|             tv.rocnik = tv.resitel.rocnik(context['cislo'].rocnik) | ||||
|             tv.resitel.titul = tv.resitel.titul(v.body_celkem) | ||||
|             tv.vysledek = v | ||||
|             #odkazuje na VysledkyKCislu | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Tomas Gavenciak
						Tomas Gavenciak