parent
							
								
									5da1fe6db4
								
							
						
					
					
						commit
						4b4568160f
					
				
					 1 changed files with 3 additions and 0 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))) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky