Add backlog decrease count

This commit is contained in:
Lukáš Kucharczyk 2023-11-09 19:15:49 +01:00
parent b0be7b5887
commit c2c0886451
3 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@
* Finished (count) * Finished (count)
* Unfinished (count) * Unfinished (count)
* Refunded (count) * Refunded (count)
* Backlog Decrease (count)
### Improved ### Improved
* game overview: simplify playtime range display * game overview: simplify playtime range display

View File

@ -64,6 +64,10 @@
<td class="px-2 sm:px-4 md:px-6 md:py-2">Unfinished</td> <td class="px-2 sm:px-4 md:px-6 md:py-2">Unfinished</td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchased_unfinished.count }} ({{ unfinished_purchases_percent }}%)</td> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchased_unfinished.count }} ({{ unfinished_purchases_percent }}%)</td>
</tr> </tr>
<tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2">Backlog Decrease</td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ backlog_decrease_count }}</td>
</tr>
<tr> <tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2">Spendings ({{ total_spent_currency }})</td> <td class="px-2 sm:px-4 md:px-6 md:py-2">Spendings ({{ total_spent_currency }})</td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ total_spent }} ({{ spent_per_game }}/game)</td> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ total_spent }} ({{ spent_per_game }}/game)</td>

View File

@ -356,6 +356,12 @@ def stats(request, year: int = 0):
for item in total_playtime_per_platform: for item in total_playtime_per_platform:
item["formatted_playtime"] = format_duration(item["total_playtime"], "%2.0H") item["formatted_playtime"] = format_duration(item["total_playtime"], "%2.0H")
backlog_decrease_count = (
Purchase.objects.filter(date_purchased__year__lt=year)
.filter(date_finished__year=year)
.count()
)
context = { context = {
"total_hours": format_duration( "total_hours": format_duration(
year_sessions.total_duration_unformatted(), "%2.0H" year_sessions.total_duration_unformatted(), "%2.0H"
@ -390,6 +396,7 @@ def stats(request, year: int = 0):
), ),
"all_purchased_refunded_this_year": all_purchased_refunded_this_year, "all_purchased_refunded_this_year": all_purchased_refunded_this_year,
"all_purchased_this_year": all_purchased_this_year, "all_purchased_this_year": all_purchased_this_year,
"backlog_decrease_count": backlog_decrease_count,
} }
request.session["return_path"] = request.path request.session["return_path"] = request.path