diff --git a/games/templates/list_sessions.html b/games/templates/list_sessions.html
index 23bf923..7e20d92 100644
--- a/games/templates/list_sessions.html
+++ b/games/templates/list_sessions.html
@@ -1,8 +1,7 @@
{% extends 'base.html' %}
-{% load static %}
-{% block title %}
- {{ title }}
-{% endblock title %}
+
+{% block title %}{{ title }}{% endblock title %}
+
{% block content %}
{% if dataset.count >= 1 %}
diff --git a/games/views.py b/games/views.py
index 6593173..20f4cb2 100644
--- a/games/views.py
+++ b/games/views.py
@@ -1,5 +1,5 @@
from datetime import datetime, timedelta
-from typing import Any, Callable
+from zoneinfo import ZoneInfo
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Count, F, Prefetch, Sum
@@ -283,16 +283,11 @@ def list_sessions(
elif filter == "game":
dataset = Session.objects.filter(purchase__edition__game=game_id)
context["game"] = Game.objects.get(id=game_id)
- elif filter == "ownership_type":
- dataset = Session.objects.filter(purchase__ownership_type=ownership_type)
- context["ownership_type"] = dict(Purchase.OWNERSHIP_TYPES)[ownership_type]
elif filter == "recent":
- current_year = timezone.now().year
- first_day_of_year = timezone.make_aware(datetime(current_year, 1, 1))
dataset = Session.objects.filter(
- timestamp_start__gte=first_day_of_year
- ).order_by("-timestamp_start")
- context["title"] = "This year"
+ timestamp_start__gte=datetime.now() - timedelta(days=30)
+ )
+ context["title"] = "Last 30 days"
else:
# by default, sort from newest to oldest
dataset = Session.objects.order_by("-timestamp_start")
@@ -547,19 +542,3 @@ def add_platform(request):
context["form"] = form
context["title"] = "Add New Platform"
return render(request, "add.html", context)
-
-
-def add_device(request):
- context = {}
- form = DeviceForm(request.POST or None)
- if form.is_valid():
- form.save()
- return redirect("index")
-
- context["form"] = form
- context["title"] = "Add New Device"
- return render(request, "add.html", context)
-
-
-def index(request):
- return redirect("list_sessions_recent")
diff --git a/timetracker/urls.py b/timetracker/urls.py
index f056a77..834ef5b 100644
--- a/timetracker/urls.py
+++ b/timetracker/urls.py
@@ -73,8 +73,8 @@ router.register(r"sessions", SessionViewSet)
urlpatterns = [
- path("api/", include(router.urls)),
- path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
+ path("", RedirectView.as_view(url="/tracker")),
+ path("tracker/", include("games.urls")),
]
if settings.DEBUG: