Skip to content

Commit

Permalink
Merge pull request #204 from honeylogic-io/float-format
Browse files Browse the repository at this point in the history
fix: round decimal number of percentage increase to 2 on detail page
  • Loading branch information
danihodovic authored Feb 28, 2024
2 parents aece8fb + 95d23cb commit 485f5f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion django_wtf/core/viewz/detail_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
obj = self.get_object()
stars_since_1m = obj.stars_since(td=timedelta(days=30))
context["stars_increase_monthly_percent"] = stars_since_1m / obj.stars * 1.0
context["stars_increase_monthly_percent"] = stars_since_1m / obj.stars * 100.0
return context


Expand Down
2 changes: 1 addition & 1 deletion django_wtf/templates/core/repository_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3 class="mt-3 text-xl">{{ object.description }}</h3>
</div>
<div class="stat-title">Stars</div>
<div class="stat-value text-info">{{ object.stars }}</div>
<div class="stat-desc">{{ stars_increase_monthly_percent }}% more than last month</div>
<div class="stat-desc">{{ stars_increase_monthly_percent | floatformat:2 }}% more than last month</div>
</div>
<div class="stat">
<div class="stat-figure text-primary">
Expand Down

0 comments on commit 485f5f4

Please sign in to comment.