Merge remote-tracking branch 'Gimli/master' into develop
This commit is contained in:
		
						commit
						1254fa4ad7
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		|  | @ -312,12 +312,15 @@ class PrehledOdevzdanychReseni(ListView): | ||||||
| 		resitel = m.Resitel.objects.filter(osoba__user=self.request.user).first() | 		resitel = m.Resitel.objects.filter(osoba__user=self.request.user).first() | ||||||
| 		qs = super().get_queryset() | 		qs = super().get_queryset() | ||||||
| 		qs = qs.filter(reseni__resitele__in=[resitel]) | 		qs = qs.filter(reseni__resitele__in=[resitel]) | ||||||
|  | 		# Setřídíme podle času doručení řešení, aby se netřídily podle okamžiku vyrobení Hodnocení | ||||||
|  | 		qs = qs.order_by('reseni__cas_doruceni') | ||||||
| 		return qs | 		return qs | ||||||
| 	 | 	 | ||||||
| 	def get_context_data(self, *args, **kwargs): | 	def get_context_data(self, *args, **kwargs): | ||||||
| 		ctx = super().get_context_data(*args, **kwargs) | 		ctx = super().get_context_data(*args, **kwargs) | ||||||
| 		# Ročník určujeme podle čísla, do jehož deadlinu došlo řešení. | 		# Ročník určujeme podle čísla, do jehož deadlinu došlo řešení. | ||||||
| 		# 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 :-/ | ||||||
|  | 		# TODO: Funkce deadline vrací deadliny v jiném ročníku, zvlášť pokud se vyrobí řešení až po deadlinu (třeba při poslání mailem) | ||||||
| 		podle_rocniku = [] | 		podle_rocniku = [] | ||||||
| 		for rocnik, hodnoceni in groupby(ctx['object_list'], lambda ho: deadline(ho.reseni.cas_doruceni)[1].rocnik if deadline(ho.reseni.cas_doruceni) is not None else None): | 		for rocnik, hodnoceni in groupby(ctx['object_list'], lambda ho: deadline(ho.reseni.cas_doruceni)[1].rocnik if deadline(ho.reseni.cas_doruceni) is not None else None): | ||||||
| 			podle_rocniku.append((rocnik, list(hodnoceni))) | 			podle_rocniku.append((rocnik, list(hodnoceni))) | ||||||
|  |  | ||||||
|  | @ -217,10 +217,10 @@ def aktivniResitele(cislo, pouze_letosni=False): | ||||||
| 		zacatek_rocniku = False | 		zacatek_rocniku = False | ||||||
| 
 | 
 | ||||||
| 	if not zacatek_rocniku: | 	if not zacatek_rocniku: | ||||||
| 		return resi_v_rocniku(letos, cislo) | 		return resi_v_rocniku(letos, cislo).filter(rok_maturity__gte=letos.druhy_rok()) | ||||||
| 	else: | 	else: | ||||||
| 		# spojíme querysety s řešiteli loni a letos do daného čísla | 		# spojíme querysety s řešiteli loni a letos do daného čísla | ||||||
| 		return (resi_v_rocniku(loni) | resi_v_rocniku(letos, cislo)).distinct() | 		return (resi_v_rocniku(loni) | resi_v_rocniku(letos, cislo)).distinct().filter(rok_maturity__gte=letos.druhy_rok()) | ||||||
| 
 | 
 | ||||||
| def viewMethodSwitch(get, post): | def viewMethodSwitch(get, post): | ||||||
| 	""" | 	""" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky