-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper function to calc achivements percentage
- Loading branch information
1 parent
3b4a8fa
commit 883c439
Showing
4 changed files
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
templates/components/tables/contributor_achievement_percentage_field.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
{% load i18n static mathfilters %} | ||
{% load i18n static contrib_extras %} | ||
|
||
<div class="progress d-flex justify-content-between" style="height: max-content;"> | ||
<div class="bg-info text-dark text-start aligns-items-center" role="progressbar" style="width: {{ contribution|div:achievement_made_count|mul:100|floatformat:0 }}%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"> | ||
<div class="bg-info text-dark text-start aligns-items-center" role="progressbar" style="width: {% calc_percent_achievement contribution achievement_made_count %}%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"> | ||
<dl class="p-2 fs-6 mb-0" style="width:50vw;"> | ||
<dt>{% trans achievement_name %}</dt> | ||
<dd class="mb-0">{% trans achievement_description %}</dd> | ||
</dl> | ||
</div> | ||
|
||
<div class="p-2 fs-6 d-flex justify-content-center align-items-center"> | ||
{% if contribution|div:achievement_made_count|mul:100 > 100 %} | ||
100.0% | ||
{% else %} | ||
{{ contribution|div:achievement_made_count|mul:100|floatformat:1 }}% | ||
{% endif %} | ||
{% calc_percent_achievement contribution achievement_made_count %}% | ||
</div> | ||
</div> |