Merge pull request 'soucet_bodu' (!70) from soucet_bodu into master
Reviewed-on: #70
This commit is contained in:
		
						commit
						502588fd3a
					
				
					 2 changed files with 8 additions and 3 deletions
				
			
		|  | @ -12,7 +12,7 @@ | |||
| 
 | ||||
| <br> | ||||
| 
 | ||||
| {% for rocnik, hodnoceni in podle_rocniku %} | ||||
| {% for rocnik, hodnoceni, suma_bodu in podle_rocniku %} | ||||
| <h1>Ročník {{ rocnik }}</h1> | ||||
| <table class="moje_reseni plne_ohranicena_tabulka"> | ||||
| 	<tr> | ||||
|  | @ -33,7 +33,7 @@ | |||
| 	</tr> | ||||
| 	{% endfor %} | ||||
| </table> | ||||
| 
 | ||||
| <p>Celkový počet bodů {{suma_bodu}}</p> | ||||
| <br> | ||||
| 
 | ||||
| {% endfor %} | ||||
|  |  | |||
|  | @ -356,7 +356,12 @@ 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 :-/ | ||||
| 		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): | ||||
| 			podle_rocniku.append((rocnik, list(hodnoceni))) | ||||
| 			suma_bodu = 0 | ||||
| 			hodnoceni = list(hodnoceni) | ||||
| 			for i in hodnoceni :  | ||||
| 				if i.body != None : suma_bodu += i.body | ||||
| 			podle_rocniku.append((rocnik, hodnoceni, suma_bodu)) | ||||
| 		 | ||||
| 		ctx['podle_rocniku'] = reversed(podle_rocniku) # Od nejnovějšího ročníku | ||||
| 		# TODO: Umožnit stažení / zobrazení řešení | ||||
| 		return ctx | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue