Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions evap/results/templates/distribution_widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
title="{% include 'result_widget_tooltip.html' with question_result=question_result %}"
>
{% include 'distribution_with_grade.html' with question_result=question_result distribution=question_result.counts|normalized_distribution average=question_result.average %}
<div class="badge-participants badge-participants-{{ question_result.count_sum|participationclass:num_voters }} ms-2 ms-lg-3">
<div class="badge-participants badge-participants-{{ question_result.count_sum|badge_decile:num_voters }} ms-2 ms-lg-3">
<span class="fas fa-user"></span> {{ question_result.count_sum }}
</div>
</div>
Expand All @@ -23,4 +23,4 @@
</div>
</div>
{% endif %}
{% endspaceless %}
{% endspaceless %}
2 changes: 1 addition & 1 deletion evap/results/templates/results_evaluation_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ <h3>{{ evaluation.full_name }} ({{ evaluation.course.semester.name }})</h3>
<div class="card-header d-flex flex-row justify-content-between">
<span>{% translate 'Dropout' %}</span>

<div class="badge-participants badge-participants-{{ evaluation.dropout_count|participationclass:evaluation.num_voters }} ms-2 ms-lg-3">
<div class="badge-participants badge-participants-{{ evaluation.dropout_count|badge_decile:evaluation.num_voters }} ms-2 ms-lg-3">
<span class="fas fa-user"></span> {{ evaluation.dropout_count }}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion evap/results/templates/textanswer_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% blocktranslate asvar intro_text %}These text answers can be seen by:{% endblocktranslate %}
{% include 'textanswer_visibility_info.html' with intro_text=intro_text visible_by_contribution=question_result.answers_visible_to.visible_by_contribution visible_by_delegation_count=question_result.answers_visible_to.visible_by_delegation_count %}
</span>
<div class="d-inline-block badge-participants badge-participants-{{ num_answers|participationclass:num_voters }} ms-2">
<div class="d-inline-block badge-participants badge-participants-{{ num_answers|badge_decile:num_voters }} ms-2">
<span class="fas fa-user"></span> {{ num_answers }}
</div>
</div>
Expand Down
8 changes: 5 additions & 3 deletions evap/results/templatetags/results_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def evaluation_results_cache_timeout(evaluation):
return 0 # don't cache at all


@register.filter(name="participationclass")
def participationclass(number_of_voters, number_of_participants):
return round((number_of_voters / number_of_participants) * 10)
@register.filter(name="badge_decile")
def badge_decile(dividend, divisor):
if divisor <= 0:
return 0
return round((dividend / divisor) * 10)


@register.filter
Expand Down