[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>Identyfikator</th>
|
||||||
<th>Uczeń</th>
|
<th>Uczeń</th>
|
||||||
<th>Klasa</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 %}
|
{% if ongoing.scores_eliminations %}
|
||||||
<th>Liczba punktów zdobytych podczas eliminacji</th>
|
<th>Liczba punktów zdobytych podczas eliminacji</th>
|
||||||
{% if ongoing.entry_threshold > 0 %}
|
{% if ongoing.entry_threshold > 0 %}
|
||||||
<th>Wynik eliminacji</th>
|
<th>Wynik eliminacji</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for student in students %}
|
{% for student in students %}
|
||||||
@ -27,6 +33,11 @@
|
|||||||
<th>{{ student.identifier }}</th>
|
<th>{{ student.identifier }}</th>
|
||||||
<td>{{ student.name }} {{ student.surname }}</td>
|
<td>{{ student.name }} {{ student.surname }}</td>
|
||||||
<td>{{ student.grade }}</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 %}
|
{% if ongoing.scores_eliminations %}
|
||||||
<td>
|
<td>
|
||||||
{{ student.score_first | default:"-" }}
|
{{ student.score_first | default:"-" }}
|
||||||
@ -41,6 +52,7 @@
|
|||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -42,10 +42,16 @@ def SubmitStudentsView(request):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if edition.submissions is not True:
|
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(
|
queryset = Student.objects.filter(
|
||||||
identifier__startswith=f'{edition.year}-{request.user.id}-').order_by('identifier')
|
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}-')
|
queryset = Student.objects.filter(identifier__startswith=f'{edition.year}-{request.user.id}-')
|
||||||
ArticleFormSet = formset_factory(StudentForm, extra=3, max_num=3, min_num=0)
|
ArticleFormSet = formset_factory(StudentForm, extra=3, max_num=3, min_num=0)
|
||||||
@ -145,6 +151,7 @@ def ScoresView(request, year=None):
|
|||||||
score_first = reduce(lambda x, y: x + y.score_first, team, 0)
|
score_first = reduce(lambda x, y: x + y.score_first, team, 0)
|
||||||
score_second = reduce(lambda x, y: x + y.score_second, team, 0)
|
score_second = reduce(lambda x, y: x + y.score_second, team, 0)
|
||||||
|
|
||||||
|
if score_first*score_second > 0:
|
||||||
teams.append({**school, 'score': score_first * score_second})
|
teams.append({**school, 'score': score_first * score_second})
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
|
Loading…
Reference in New Issue
Block a user