use unified dateformat more
Django CI/CD / test (push) Successful in 56s Details
Django CI/CD / build-and-push (push) Successful in 2m13s Details

This commit is contained in:
Lukáš Kucharczyk 2024-10-14 14:26:48 +02:00
parent 62a1fab15f
commit 3314c9b42b
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render from django.shortcuts import redirect, render
from django.urls import reverse from django.urls import reverse
from common.time import format_duration from common.time import dateformat, format_duration
from common.utils import safe_division from common.utils import safe_division
from games.models import Edition, Game, Platform, Purchase, Session from games.models import Edition, Game, Platform, Purchase, Session
@ -173,10 +173,10 @@ def stats_alltime(request: HttpRequest) -> HttpResponse:
if this_year_sessions: if this_year_sessions:
first_session = this_year_sessions.earliest() first_session = this_year_sessions.earliest()
first_play_game = first_session.purchase.edition.game first_play_game = first_session.purchase.edition.game
first_play_date = first_session.timestamp_start.strftime("%x") first_play_date = first_session.timestamp_start.strftime(dateformat)
last_session = this_year_sessions.latest() last_session = this_year_sessions.latest()
last_play_game = last_session.purchase.edition.game last_play_game = last_session.purchase.edition.game
last_play_date = last_session.timestamp_start.strftime("%x") last_play_date = last_session.timestamp_start.strftime(dateformat)
all_purchased_this_year_count = this_year_purchases_with_currency.count() all_purchased_this_year_count = this_year_purchases_with_currency.count()
all_purchased_refunded_this_year_count: int = this_year_purchases_refunded.count() all_purchased_refunded_this_year_count: int = this_year_purchases_refunded.count()
@ -400,10 +400,10 @@ def stats(request: HttpRequest, year: int = 0) -> HttpResponse:
if this_year_sessions: if this_year_sessions:
first_session = this_year_sessions.earliest() first_session = this_year_sessions.earliest()
first_play_game = first_session.purchase.edition.game first_play_game = first_session.purchase.edition.game
first_play_date = first_session.timestamp_start.strftime("%x") first_play_date = first_session.timestamp_start.strftime(dateformat)
last_session = this_year_sessions.latest() last_session = this_year_sessions.latest()
last_play_game = last_session.purchase.edition.game last_play_game = last_session.purchase.edition.game
last_play_date = last_session.timestamp_start.strftime("%x") last_play_date = last_session.timestamp_start.strftime(dateformat)
all_purchased_this_year_count = this_year_purchases_with_currency.count() all_purchased_this_year_count = this_year_purchases_with_currency.count()
all_purchased_refunded_this_year_count = this_year_purchases_refunded.count() all_purchased_refunded_this_year_count = this_year_purchases_refunded.count()