Compare commits

..

No commits in common. "d211326c3fe0501db3133db8503acbb3645eb65d" and "015b6db2f737b2d4f976745de2844f264dbd46e5" have entirely different histories.

3 changed files with 2 additions and 16 deletions

View File

@ -1,8 +1,3 @@
### Unreleased
## New
* Add stat for finished this year's games
## 1.4.0 / 2023-11-09 21:01+01:00 ## 1.4.0 / 2023-11-09 21:01+01:00
### New ### New

View File

@ -45,10 +45,6 @@
<td class="px-2 sm:px-4 md:px-6 md:py-2">Finished</td> <td class="px-2 sm:px-4 md:px-6 md:py-2">Finished</td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ all_finished_this_year.count }}</td> <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ all_finished_this_year.count }}</td>
</tr> </tr>
<tr>
<td class="px-2 sm:px-4 md:px-6 md:py-2">Finished ({{ year }})</td>
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ this_year_finished_this_year.count }}</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -32,12 +32,7 @@ def model_counts(request):
def stats_dropdown_year_range(request): def stats_dropdown_year_range(request):
result = { return {"stats_dropdown_year_range": range(2018, 2024)}
"stats_dropdown_year_range": range(
datetime.now(ZoneInfo(settings.TIME_ZONE)).year, 1999, -1
)
}
return result
def add_session(request, purchase_id=None): def add_session(request, purchase_id=None):
@ -336,7 +331,7 @@ def stats(request, year: int = 0):
this_year_spendings = this_year_purchases_without_refunded.aggregate( this_year_spendings = this_year_purchases_without_refunded.aggregate(
total_spent=Sum(F("price")) total_spent=Sum(F("price"))
) )
total_spent = this_year_spendings["total_spent"] or 0 total_spent = this_year_spendings["total_spent"]
games_with_playtime = ( games_with_playtime = (
Game.objects.filter(edition__purchase__session__in=this_year_sessions) Game.objects.filter(edition__purchase__session__in=this_year_sessions)