[func] don't show shchools without points [func] show ranking and scores for teachers
This commit is contained in:
parent
befa154b4e
commit
8e8474920f
@ -13,12 +13,18 @@
|
||||
<th>Identyfikator</th>
|
||||
<th>Uczeń</th>
|
||||
<th>Klasa</th>
|
||||
{% if ongoing.scores_available %}
|
||||
<th>Zajęte miejsce</th>
|
||||
<th>Wynik z finału</th>
|
||||
<th>Wynik z eliminacji</th>
|
||||
{% else %}
|
||||
{% if ongoing.scores_eliminations %}
|
||||
<th>Liczba punktów zdobytych podczas eliminacji</th>
|
||||
{% if ongoing.entry_threshold > 0 %}
|
||||
<th>Wynik eliminacji</th>
|
||||
{% endif %}
|
||||
{%endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
{% for student in students %}
|
||||
@ -27,6 +33,11 @@
|
||||
<th>{{ student.identifier }}</th>
|
||||
<td>{{ student.name }} {{ student.surname }}</td>
|
||||
<td>{{ student.grade }}</td>
|
||||
{% if ongoing.scores_available %}
|
||||
<th>{{ student.ranking }}</td>
|
||||
<td>{{ student.score_second }}</td>
|
||||
<td>{{ student.score_first }}</td>
|
||||
{% else %}
|
||||
{% if ongoing.scores_eliminations %}
|
||||
<td>
|
||||
{{ student.score_first | default:"-" }}
|
||||
@ -41,6 +52,7 @@
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</tr>
|
||||
</tbody>
|
||||
{% endfor %}
|
||||
@ -51,4 +63,4 @@
|
||||
<span class="title mt-6">Żaden uczeń nie został zgłoszony</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
11
app/views.py
11
app/views.py
@ -42,10 +42,16 @@ def SubmitStudentsView(request):
|
||||
}
|
||||
|
||||
if edition.submissions is not True:
|
||||
ranking = {}
|
||||
for index, student in enumerate(sorted(Student.objects.filter(identifier__startswith=f'{edition.year}-'), key=lambda x: x.score_first*x.score_second, reversed=True)):
|
||||
ranking[student.identifier] = index + 1
|
||||
|
||||
queryset = Student.objects.filter(
|
||||
identifier__startswith=f'{edition.year}-{request.user.id}-').order_by('identifier')
|
||||
|
||||
return render(request, 'user/submission.html', {'students': queryset, **context})
|
||||
students = [{**student.__dict__, 'ranking': ranking[student.identifier]} for queryset]
|
||||
|
||||
return render(request, 'user/submission.html', {'students': students, **context})
|
||||
|
||||
queryset = Student.objects.filter(identifier__startswith=f'{edition.year}-{request.user.id}-')
|
||||
ArticleFormSet = formset_factory(StudentForm, extra=3, max_num=3, min_num=0)
|
||||
@ -145,7 +151,8 @@ def ScoresView(request, year=None):
|
||||
score_first = reduce(lambda x, y: x + y.score_first, team, 0)
|
||||
score_second = reduce(lambda x, y: x + y.score_second, team, 0)
|
||||
|
||||
teams.append({**school, 'score': score_first * score_second})
|
||||
if score_first*score_second > 0:
|
||||
teams.append({**school, 'score': score_first * score_second})
|
||||
|
||||
context = {
|
||||
'individual': sorted(individual, key=lambda x: -x['score']),
|
||||
|
Loading…
Reference in New Issue
Block a user