odmeny jsou pekny #90
					 2 changed files with 15 additions and 3 deletions
				
			
		|  | @ -16,4 +16,11 @@ | ||||||
| 	  {% endfor %} | 	  {% endfor %} | ||||||
|   </ul> |   </ul> | ||||||
| 
 | 
 | ||||||
|  |   <h2>Seznam účastníků – červená znamená že jim nechodí fyzické číslo</h2> | ||||||
|  |   <ul> | ||||||
|  |     {% for resitel in resitele %} | ||||||
|  |       <li {% if resitel.neposilame %}style="color: white; background-color: red;"{% endif %}>{{ resitel.jmeno }}: {% if resitel.bodydiff > 3 %}🧦{% endif %} {% if resitel.ttitul != resitel.ftitul %} {{resitel.ftitul}} → {{resitel.ttitul}} {% endif %}</li> | ||||||
|  | |||||||
|  |     {% endfor %} | ||||||
|  |   </ul> | ||||||
|  | 
 | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  |  | ||||||
|  | @ -375,7 +375,8 @@ class OdmenyView(generic.TemplateView): | ||||||
| 		tocislo = get_object_or_404(Cislo, rocnik=self.kwargs.get('trocnik'), poradi=self.kwargs.get('tcislo')) | 		tocislo = get_object_or_404(Cislo, rocnik=self.kwargs.get('trocnik'), poradi=self.kwargs.get('tcislo')) | ||||||
| 		resitele = utils.aktivniResitele(tocislo) | 		resitele = utils.aktivniResitele(tocislo) | ||||||
| 
 | 
 | ||||||
| 		def get_diff(from_deadline: Deadline, to_deadline: Deadline): | 		def get_diff(from_deadline: Deadline, to_deadline: Deadline, probody=False): | ||||||
|  | 			"""Co je probody? pokud True, funkce vrací všechny rešitele a k nim potřebné informace, pokud False, vrací jen ty, kteří mají změnu v titulu.""" | ||||||
| 			frombody = body_resitelu(resitele=resitele, jen_verejne=False, do=from_deadline) | 			frombody = body_resitelu(resitele=resitele, jen_verejne=False, do=from_deadline) | ||||||
| 			tobody = body_resitelu(resitele=resitele, jen_verejne=False, do=to_deadline) | 			tobody = body_resitelu(resitele=resitele, jen_verejne=False, do=to_deadline) | ||||||
| 			outlist = [] | 			outlist = [] | ||||||
|  | @ -384,6 +385,9 @@ class OdmenyView(generic.TemplateView): | ||||||
| 				tbody = tobody.get(resitel.id, 0) | 				tbody = tobody.get(resitel.id, 0) | ||||||
| 				ftitul = resitel.get_titul(fbody) | 				ftitul = resitel.get_titul(fbody) | ||||||
| 				ttitul = resitel.get_titul(tbody) | 				ttitul = resitel.get_titul(tbody) | ||||||
|  | 				if probody: | ||||||
|  | 					outlist.append({'jmeno': resitel.osoba.plne_jmeno(), 'fbody': fbody, 'tbody': tbody, 'ftitul': ftitul, 'ttitul': ttitul, 'bodydiff': tbody - fbody, "neposilame": not(resitel.zasilat_cislo_papirove)}) | ||||||
|  | 				else: | ||||||
| 					if ftitul != ttitul: | 					if ftitul != ttitul: | ||||||
| 						outlist.append({'jmeno': resitel.osoba.plne_jmeno(), 'ftitul': ftitul, 'ttitul': ttitul}) | 						outlist.append({'jmeno': resitel.osoba.plne_jmeno(), 'ftitul': ftitul, 'ttitul': ttitul}) | ||||||
| 			return outlist | 			return outlist | ||||||
|  | @ -401,6 +405,7 @@ class OdmenyView(generic.TemplateView): | ||||||
| 		context["from_deadline"] = from_deadline | 		context["from_deadline"] = from_deadline | ||||||
| 		context["to_deadline"] = to_deadline | 		context["to_deadline"] = to_deadline | ||||||
| 		context["zmeny"] = get_diff(from_deadline, to_deadline) | 		context["zmeny"] = get_diff(from_deadline, to_deadline) | ||||||
|  | 		context["resitele"] = get_diff(from_deadline, to_deadline, probody=resitele.order_by("osoba__prijmeni")) | ||||||
| 
 | 
 | ||||||
| 		return context | 		return context | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	
CSS?
Ano, to je css