<p> se souctem bodu pod odevzdana reseni
This commit is contained in:
		
							parent
							
								
									8156f7828e
								
							
						
					
					
						commit
						e660a96df2
					
				
					 2 changed files with 9 additions and 3 deletions
				
			
		|  | @ -12,7 +12,7 @@ | ||||||
| 
 | 
 | ||||||
| <br> | <br> | ||||||
| 
 | 
 | ||||||
| {% for rocnik, hodnoceni in podle_rocniku %} | {% for rocnik, hodnoceni, suma_bodu in podle_rocniku %} | ||||||
| <h1>Ročník {{ rocnik }}</h1> | <h1>Ročník {{ rocnik }}</h1> | ||||||
| <table class="moje_reseni plne_ohranicena_tabulka"> | <table class="moje_reseni plne_ohranicena_tabulka"> | ||||||
| 	<tr> | 	<tr> | ||||||
|  | @ -33,7 +33,7 @@ | ||||||
| 	</tr> | 	</tr> | ||||||
| 	{% endfor %} | 	{% endfor %} | ||||||
| </table> | </table> | ||||||
| 
 | <p>Celkový počet bodů {{suma_bodu}}</p> | ||||||
| <br> | <br> | ||||||
| 
 | 
 | ||||||
| {% endfor %} | {% endfor %} | ||||||
|  |  | ||||||
|  | @ -352,7 +352,13 @@ class PrehledOdevzdanychReseni(ListView): | ||||||
| 		# Chceme to mít seřazené, takže místo comphrerehsion ručně postavíme pole polí. Django templates neumí použít OrderedDict :-/ | 		# Chceme to mít seřazené, takže místo comphrerehsion ručně postavíme pole polí. Django templates neumí použít OrderedDict :-/ | ||||||
| 		podle_rocniku = [] | 		podle_rocniku = [] | ||||||
| 		for rocnik, hodnoceni in groupby(ctx['object_list'], lambda ho: ho.deadline_body.cislo.rocnik if ho.deadline_body is not None else None): | 		for rocnik, hodnoceni in groupby(ctx['object_list'], lambda ho: ho.deadline_body.cislo.rocnik if ho.deadline_body is not None else None): | ||||||
| 			podle_rocniku.append((rocnik, list(hodnoceni))) | 			suma_bodu = 0 | ||||||
|  | 			hodnoceni = list(hodnoceni) | ||||||
|  | 			hodnoceni[0].body = None | ||||||
|  | 			for i in hodnoceni :  | ||||||
|  | 				if i.body != None : suma_bodu += i.body | ||||||
|  | 			podle_rocniku.append((rocnik, list(hodnoceni),suma_bodu)) | ||||||
|  | 		 | ||||||
| 		ctx['podle_rocniku'] = reversed(podle_rocniku) # Od nejnovějšího ročníku | 		ctx['podle_rocniku'] = reversed(podle_rocniku) # Od nejnovějšího ročníku | ||||||
| 		# TODO: Umožnit stažení / zobrazení řešení | 		# TODO: Umožnit stažení / zobrazení řešení | ||||||
| 		return ctx | 		return ctx | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue