Compare commits
10 Commits
2e5e77b4e5
...
fda4913c97
Author | SHA1 | Date |
---|---|---|
Lukáš Kucharczyk | fda4913c97 | |
Lukáš Kucharczyk | e85b32e22f | |
Lukáš Kucharczyk | 2d6d6d24a4 | |
Lukáš Kucharczyk | 00993a85db | |
Lukáš Kucharczyk | 4f7e708255 | |
Lukáš Kucharczyk | 238e4839e0 | |
Lukáš Kucharczyk | b0ad806a93 | |
Lukáš Kucharczyk | 453b4fd922 | |
Lukáš Kucharczyk | bb0d24809e | |
Lukáš Kucharczyk | 3abd4c4af9 |
|
@ -1,10 +1,10 @@
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 24.3.0
|
rev: 24.8.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/pycqa/isort
|
- repo: https://github.com/pycqa/isort
|
||||||
rev: 5.12.0
|
rev: 5.13.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
name: isort (python)
|
name: isort (python)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"ms-python.black-formatter",
|
"charliermarsh.ruff",
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
"ms-python.vscode-pylance",
|
"ms-python.vscode-pylance",
|
||||||
"ms-python.debugpy",
|
"ms-python.debugpy",
|
||||||
|
|
|
@ -6,9 +6,14 @@
|
||||||
"python.testing.pytestEnabled": true,
|
"python.testing.pytestEnabled": true,
|
||||||
"python.analysis.typeCheckingMode": "strict",
|
"python.analysis.typeCheckingMode": "strict",
|
||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
"editor.defaultFormatter": "charliermarsh.ruff",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": "explicit",
|
||||||
|
"source.organizeImports": "explicit"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
"ruff.path": ["/nix/store/s3q6qc2954x62bkcs9dwaxyiqchl7j01-ruff-0.5.6/bin/ruff"],
|
||||||
"tailwind-fold.supportedLanguages": [
|
"tailwind-fold.supportedLanguages": [
|
||||||
"html",
|
"html",
|
||||||
"typescriptreact",
|
"typescriptreact",
|
||||||
|
|
|
@ -20,7 +20,7 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
||||||
purchases = Purchase.objects.order_by("-date_purchased")
|
purchases = Purchase.objects.order_by("-date_purchased")
|
||||||
page_obj = None
|
page_obj = None
|
||||||
if int(limit) != 0:
|
if int(limit) != 0:
|
||||||
paginator = Paginator(Purchase.objects.order_by("-date_purchased"), limit)
|
paginator = Paginator(purchases, limit)
|
||||||
page_obj = paginator.get_page(page_number)
|
page_obj = paginator.get_page(page_number)
|
||||||
purchases = page_obj.object_list
|
purchases = page_obj.object_list
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.core.paginator import Paginator
|
||||||
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
from django.shortcuts import render
|
||||||
|
from django.template.loader import render_to_string
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from common.time import format_duration
|
||||||
|
from games.models import Session
|
||||||
|
from games.views import dateformat, datetimeformat, timeformat
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def list_sessions(request: HttpRequest) -> HttpResponse:
|
||||||
|
context: dict[Any, Any] = {}
|
||||||
|
page_number = request.GET.get("page", 1)
|
||||||
|
limit = request.GET.get("limit", 10)
|
||||||
|
sessions = Session.objects.order_by("-created_at")
|
||||||
|
page_obj = None
|
||||||
|
if int(limit) != 0:
|
||||||
|
paginator = Paginator(sessions, limit)
|
||||||
|
page_obj = paginator.get_page(page_number)
|
||||||
|
sessions = page_obj.object_list
|
||||||
|
|
||||||
|
context = {
|
||||||
|
"title": "Manage sessions",
|
||||||
|
"page_obj": page_obj or None,
|
||||||
|
"elided_page_range": (
|
||||||
|
page_obj.paginator.get_elided_page_range(
|
||||||
|
page_number, on_each_side=1, on_ends=1
|
||||||
|
)
|
||||||
|
if page_obj
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"data": {
|
||||||
|
"columns": [
|
||||||
|
"Name",
|
||||||
|
"Date",
|
||||||
|
"Duration",
|
||||||
|
"Duration (manual)",
|
||||||
|
"Device",
|
||||||
|
"Created",
|
||||||
|
"Actions",
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
session.purchase.edition.name,
|
||||||
|
f"{session.timestamp_start.strftime(datetimeformat)}{f" — {session.timestamp_end.strftime(timeformat)}" if session.timestamp_end else ""}",
|
||||||
|
(
|
||||||
|
format_duration(session.duration_calculated, "%2.1H hours")
|
||||||
|
if session.duration_calculated
|
||||||
|
else "-"
|
||||||
|
),
|
||||||
|
(
|
||||||
|
format_duration(session.duration_manual)
|
||||||
|
if session.duration_manual
|
||||||
|
else "-"
|
||||||
|
),
|
||||||
|
session.device,
|
||||||
|
session.created_at.strftime(dateformat),
|
||||||
|
render_to_string(
|
||||||
|
"components/button_group_sm.html",
|
||||||
|
{
|
||||||
|
"buttons": [
|
||||||
|
{
|
||||||
|
"href": reverse("edit_session", args=[session.pk]),
|
||||||
|
"text": "Edit",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"href": reverse(
|
||||||
|
"delete_session", args=[session.pk]
|
||||||
|
),
|
||||||
|
"text": "Delete",
|
||||||
|
"color": "red",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
for session in sessions
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return render(request, "list_purchases.html", context)
|
|
@ -1346,10 +1346,6 @@ input:checked + .toggle-bg {
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
.z-0 {
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx-2 {
|
.mx-2 {
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
|
@ -1406,6 +1402,10 @@ input:checked + .toggle-bg {
|
||||||
margin-inline-start: 0px;
|
margin-inline-start: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-2\.5 {
|
||||||
|
margin-inline-start: 0.625rem;
|
||||||
|
}
|
||||||
|
|
||||||
.mt-2 {
|
.mt-2 {
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
@ -1414,10 +1414,6 @@ input:checked + .toggle-bg {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-2\.5 {
|
|
||||||
margin-inline-start: 0.625rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
@ -1455,12 +1451,16 @@ input:checked + .toggle-bg {
|
||||||
height: 1.5rem;
|
height: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.h-10 {
|
||||||
|
height: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.h-12 {
|
.h-12 {
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h-24 {
|
.h-2\.5 {
|
||||||
height: 6rem;
|
height: 0.625rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h-3 {
|
.h-3 {
|
||||||
|
@ -1487,14 +1487,6 @@ input:checked + .toggle-bg {
|
||||||
height: 2.25rem;
|
height: 2.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h-10 {
|
|
||||||
height: 2.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.h-2\.5 {
|
|
||||||
height: 0.625rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.min-h-screen {
|
.min-h-screen {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
@ -1503,6 +1495,14 @@ input:checked + .toggle-bg {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.w-10 {
|
||||||
|
width: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-2\.5 {
|
||||||
|
width: 0.625rem;
|
||||||
|
}
|
||||||
|
|
||||||
.w-24 {
|
.w-24 {
|
||||||
width: 6rem;
|
width: 6rem;
|
||||||
}
|
}
|
||||||
|
@ -1511,6 +1511,10 @@ input:checked + .toggle-bg {
|
||||||
width: 1rem;
|
width: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.w-44 {
|
||||||
|
width: 11rem;
|
||||||
|
}
|
||||||
|
|
||||||
.w-5 {
|
.w-5 {
|
||||||
width: 1.25rem;
|
width: 1.25rem;
|
||||||
}
|
}
|
||||||
|
@ -1527,38 +1531,22 @@ input:checked + .toggle-bg {
|
||||||
width: 1.75rem;
|
width: 1.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.w-auto {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.w-full {
|
.w-full {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.w-10 {
|
|
||||||
width: 2.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.w-2\.5 {
|
|
||||||
width: 0.625rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.w-44 {
|
|
||||||
width: 11rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-w-80 {
|
.max-w-80 {
|
||||||
max-width: 20rem;
|
max-width: 20rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-w-screen-2xl {
|
|
||||||
max-width: 1536px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-w-screen-lg {
|
.max-w-screen-lg {
|
||||||
max-width: 1024px;
|
max-width: 1024px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.max-w-screen-xl {
|
||||||
|
max-width: 1280px;
|
||||||
|
}
|
||||||
|
|
||||||
.max-w-sm {
|
.max-w-sm {
|
||||||
max-width: 24rem;
|
max-width: 24rem;
|
||||||
}
|
}
|
||||||
|
@ -1567,10 +1555,6 @@ input:checked + .toggle-bg {
|
||||||
max-width: 20rem;
|
max-width: 20rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-w-screen-xl {
|
|
||||||
max-width: 1280px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1 1 0%;
|
flex: 1 1 0%;
|
||||||
}
|
}
|
||||||
|
@ -1764,6 +1748,10 @@ input:checked + .toggle-bg {
|
||||||
text-wrap: wrap;
|
text-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.rounded {
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.rounded-full {
|
.rounded-full {
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
}
|
}
|
||||||
|
@ -1780,10 +1768,6 @@ input:checked + .toggle-bg {
|
||||||
border-radius: 0.125rem;
|
border-radius: 0.125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rounded {
|
|
||||||
border-radius: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rounded-e-lg {
|
.rounded-e-lg {
|
||||||
border-start-end-radius: 0.5rem;
|
border-start-end-radius: 0.5rem;
|
||||||
border-end-end-radius: 0.5rem;
|
border-end-end-radius: 0.5rem;
|
||||||
|
@ -1861,6 +1845,11 @@ input:checked + .toggle-bg {
|
||||||
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
|
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-gray-400 {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-gray-50 {
|
.bg-gray-50 {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
||||||
|
@ -1894,20 +1883,14 @@ input:checked + .toggle-bg {
|
||||||
background-color: rgb(255 255 255 / 0.5);
|
background-color: rgb(255 255 255 / 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-gray-300 {
|
|
||||||
--tw-bg-opacity: 1;
|
|
||||||
background-color: rgb(209 213 219 / var(--tw-bg-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-gray-400 {
|
|
||||||
--tw-bg-opacity: 1;
|
|
||||||
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-1 {
|
.p-1 {
|
||||||
padding: 0.25rem;
|
padding: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-2 {
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.p-2\.5 {
|
.p-2\.5 {
|
||||||
padding: 0.625rem;
|
padding: 0.625rem;
|
||||||
}
|
}
|
||||||
|
@ -1916,10 +1899,6 @@ input:checked + .toggle-bg {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.p-2 {
|
|
||||||
padding: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.px-2 {
|
.px-2 {
|
||||||
padding-left: 0.5rem;
|
padding-left: 0.5rem;
|
||||||
padding-right: 0.5rem;
|
padding-right: 0.5rem;
|
||||||
|
@ -1970,18 +1949,6 @@ input:checked + .toggle-bg {
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl-3 {
|
|
||||||
padding-left: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pr-4 {
|
|
||||||
padding-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pt-1 {
|
|
||||||
padding-top: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pt-2 {
|
.pt-2 {
|
||||||
padding-top: 0.5rem;
|
padding-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
@ -2096,6 +2063,11 @@ input:checked + .toggle-bg {
|
||||||
color: rgb(28 100 242 / var(--tw-text-opacity));
|
color: rgb(28 100 242 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-gray-300 {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(209 213 219 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.text-gray-400 {
|
.text-gray-400 {
|
||||||
--tw-text-opacity: 1;
|
--tw-text-opacity: 1;
|
||||||
color: rgb(156 163 175 / var(--tw-text-opacity));
|
color: rgb(156 163 175 / var(--tw-text-opacity));
|
||||||
|
@ -2146,16 +2118,6 @@ input:checked + .toggle-bg {
|
||||||
color: rgb(250 202 21 / var(--tw-text-opacity));
|
color: rgb(250 202 21 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-gray-300 {
|
|
||||||
--tw-text-opacity: 1;
|
|
||||||
color: rgb(209 213 219 / var(--tw-text-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-gray-100 {
|
|
||||||
--tw-text-opacity: 1;
|
|
||||||
color: rgb(243 244 246 / var(--tw-text-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.underline {
|
.underline {
|
||||||
text-decoration-line: underline;
|
text-decoration-line: underline;
|
||||||
}
|
}
|
||||||
|
@ -2249,6 +2211,10 @@ input:checked + .toggle-bg {
|
||||||
max-width: 20ch;
|
max-width: 20ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.min-w-30char {
|
||||||
|
min-width: 30ch;
|
||||||
|
}
|
||||||
|
|
||||||
.max-w-30char {
|
.max-w-30char {
|
||||||
max-width: 30ch;
|
max-width: 30ch;
|
||||||
}
|
}
|
||||||
|
@ -2542,11 +2508,6 @@ textarea:disabled:is(.dark *) {
|
||||||
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.hover\:bg-gray-400:hover {
|
|
||||||
--tw-bg-opacity: 1;
|
|
||||||
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.hover\:bg-gray-50:hover {
|
.hover\:bg-gray-50:hover {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
||||||
|
@ -2612,10 +2573,6 @@ textarea:disabled:is(.dark *) {
|
||||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.hover\:underline:hover {
|
|
||||||
text-decoration-line: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.focus\:z-10:focus {
|
.focus\:z-10:focus {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
@ -2696,10 +2653,6 @@ textarea:disabled:is(.dark *) {
|
||||||
top: -2rem;
|
top: -2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group:hover .group-hover\:block {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.group:hover .group-hover\:min-w-60 {
|
.group:hover .group-hover\:min-w-60 {
|
||||||
min-width: 15rem;
|
min-width: 15rem;
|
||||||
}
|
}
|
||||||
|
@ -2820,6 +2773,11 @@ textarea:disabled:is(.dark *) {
|
||||||
color: rgb(63 131 248 / var(--tw-text-opacity));
|
color: rgb(63 131 248 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dark\:text-gray-200:is(.dark *) {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(229 231 235 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.dark\:text-gray-400:is(.dark *) {
|
.dark\:text-gray-400:is(.dark *) {
|
||||||
--tw-text-opacity: 1;
|
--tw-text-opacity: 1;
|
||||||
color: rgb(156 163 175 / var(--tw-text-opacity));
|
color: rgb(156 163 175 / var(--tw-text-opacity));
|
||||||
|
@ -2855,11 +2813,6 @@ textarea:disabled:is(.dark *) {
|
||||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark\:text-gray-200:is(.dark *) {
|
|
||||||
--tw-text-opacity: 1;
|
|
||||||
color: rgb(229 231 235 / var(--tw-text-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.odd\:dark\:bg-gray-900:is(.dark *):nth-child(odd) {
|
.odd\:dark\:bg-gray-900:is(.dark *):nth-child(odd) {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
|
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
|
||||||
|
@ -2935,9 +2888,9 @@ textarea:disabled:is(.dark *) {
|
||||||
--tw-ring-color: rgb(63 131 248 / var(--tw-ring-opacity));
|
--tw-ring-color: rgb(63 131 248 / var(--tw-ring-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark\:focus\:ring-gray-700:focus:is(.dark *) {
|
.dark\:focus\:ring-gray-600:focus:is(.dark *) {
|
||||||
--tw-ring-opacity: 1;
|
--tw-ring-opacity: 1;
|
||||||
--tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity));
|
--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark\:focus\:ring-green-500:focus:is(.dark *) {
|
.dark\:focus\:ring-green-500:focus:is(.dark *) {
|
||||||
|
@ -2945,11 +2898,6 @@ textarea:disabled:is(.dark *) {
|
||||||
--tw-ring-color: rgb(14 159 110 / var(--tw-ring-opacity));
|
--tw-ring-color: rgb(14 159 110 / var(--tw-ring-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark\:focus\:ring-gray-600:focus:is(.dark *) {
|
|
||||||
--tw-ring-opacity: 1;
|
|
||||||
--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 640px) {
|
@media (min-width: 640px) {
|
||||||
.sm\:inline {
|
.sm\:inline {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
@ -2963,14 +2911,14 @@ textarea:disabled:is(.dark *) {
|
||||||
max-width: 28rem;
|
max-width: 28rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sm\:max-w-xl {
|
|
||||||
max-width: 36rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sm\:max-w-screen-sm {
|
.sm\:max-w-screen-sm {
|
||||||
max-width: 640px;
|
max-width: 640px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sm\:max-w-xl {
|
||||||
|
max-width: 36rem;
|
||||||
|
}
|
||||||
|
|
||||||
.sm\:rounded-lg {
|
.sm\:rounded-lg {
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
</div>
|
</div>
|
||||||
{% load version %}
|
{% load version %}
|
||||||
<span class="fixed left-2 bottom-2 text-xs text-slate-300 dark:text-slate-600">{% version %} ({% version_date
|
<span class="fixed left-2 bottom-2 text-xs text-slate-300 dark:text-slate-600">{% version %} ({% version_date %})</span>
|
||||||
%})</span>
|
|
||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
{% fragment as default_content %}
|
{% fragment as default_content %}
|
||||||
|
{% load randomid %}
|
||||||
{% for td in data %}
|
{% for td in data %}
|
||||||
{% if forloop.first %}
|
{% if forloop.first %}
|
||||||
<th scope="row"
|
<th scope="row"
|
||||||
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white min-w-30-char max-w-30char text-ellipsis overflow-hidden">
|
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white min-w-30char">
|
||||||
<span title="{{ td }}">{{ td }}</span>
|
{% randomid td as th_popover_id %}
|
||||||
|
<span data-popover-target="{{ th_popover_id }}">{{ td|truncatechars:30 }}</span>
|
||||||
|
{% if td|length > 30 %}
|
||||||
|
{% #popover id=th_popover_id %}
|
||||||
|
{{ td }}
|
||||||
|
{% /popover %}
|
||||||
|
{% endif %}
|
||||||
</th>
|
</th>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% #table_td %}
|
{% #table_td %}
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Purchases</a>
|
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Purchases</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'add_session' %}"
|
<a href="{% url 'list_sessions' %}"
|
||||||
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Sessions</a>
|
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">Sessions</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def randomid(seed: str = "") -> str:
|
||||||
|
return str(hash(seed + "".join(random.choices(string.ascii_lowercase, k=10))))
|
|
@ -1,6 +1,6 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from games import purchaseviews, views
|
from games import purchaseviews, sessionviews, views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", views.index, name="index"),
|
path("", views.index, name="index"),
|
||||||
|
@ -76,7 +76,7 @@ urlpatterns = [
|
||||||
{"template": "list_sessions.html#session-row"},
|
{"template": "list_sessions.html#session-row"},
|
||||||
name="list_sessions_end_session",
|
name="list_sessions_end_session",
|
||||||
),
|
),
|
||||||
path("session/list", views.list_sessions, name="list_sessions"),
|
path("session/list", sessionviews.list_sessions, name="list_sessions"),
|
||||||
path(
|
path(
|
||||||
"session/list/recent",
|
"session/list/recent",
|
||||||
views.list_sessions,
|
views.list_sessions,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Callable, TypedDict
|
from typing import Any, Callable
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Avg, Count, ExpressionWrapper, F, Prefetch, Q, Sum, fields
|
from django.db.models import Avg, Count, ExpressionWrapper, F, Prefetch, Q, Sum, fields
|
||||||
|
@ -26,10 +26,11 @@ from .forms import (
|
||||||
PurchaseForm,
|
PurchaseForm,
|
||||||
SessionForm,
|
SessionForm,
|
||||||
)
|
)
|
||||||
from .models import Edition, Game, Platform, Purchase, PurchaseQueryset, Session
|
from .models import Edition, Game, Platform, Purchase, Session
|
||||||
|
|
||||||
dateformat: str = "%d/%m/%Y"
|
dateformat: str = "%d/%m/%Y"
|
||||||
datetimeformat: str = "%d/%m/%Y %H:%M"
|
datetimeformat: str = "%d/%m/%Y %H:%M"
|
||||||
|
timeformat = "%H:%M"
|
||||||
|
|
||||||
|
|
||||||
def model_counts(request: HttpRequest) -> dict[str, bool]:
|
def model_counts(request: HttpRequest) -> dict[str, bool]:
|
||||||
|
@ -79,7 +80,7 @@ def add_session(request: HttpRequest, purchase_id: int = 0) -> HttpResponse:
|
||||||
|
|
||||||
|
|
||||||
def use_custom_redirect(
|
def use_custom_redirect(
|
||||||
func: Callable[..., HttpResponse]
|
func: Callable[..., HttpResponse],
|
||||||
) -> Callable[..., HttpResponse]:
|
) -> Callable[..., HttpResponse]:
|
||||||
"""
|
"""
|
||||||
Will redirect to "return_path" session variable if set.
|
Will redirect to "return_path" session variable if set.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""Django's command-line utility for administrative tasks."""
|
"""Django's command-line utility for administrative tasks."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -28,50 +28,6 @@ files = [
|
||||||
[package.extras]
|
[package.extras]
|
||||||
tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"]
|
tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "black"
|
|
||||||
version = "24.8.0"
|
|
||||||
description = "The uncompromising code formatter."
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.8"
|
|
||||||
files = [
|
|
||||||
{file = "black-24.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:09cdeb74d494ec023ded657f7092ba518e8cf78fa8386155e4a03fdcc44679e6"},
|
|
||||||
{file = "black-24.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:81c6742da39f33b08e791da38410f32e27d632260e599df7245cccee2064afeb"},
|
|
||||||
{file = "black-24.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:707a1ca89221bc8a1a64fb5e15ef39cd755633daa672a9db7498d1c19de66a42"},
|
|
||||||
{file = "black-24.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d6417535d99c37cee4091a2f24eb2b6d5ec42b144d50f1f2e436d9fe1916fe1a"},
|
|
||||||
{file = "black-24.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fb6e2c0b86bbd43dee042e48059c9ad7830abd5c94b0bc518c0eeec57c3eddc1"},
|
|
||||||
{file = "black-24.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:837fd281f1908d0076844bc2b801ad2d369c78c45cf800cad7b61686051041af"},
|
|
||||||
{file = "black-24.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:62e8730977f0b77998029da7971fa896ceefa2c4c4933fcd593fa599ecbf97a4"},
|
|
||||||
{file = "black-24.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:72901b4913cbac8972ad911dc4098d5753704d1f3c56e44ae8dce99eecb0e3af"},
|
|
||||||
{file = "black-24.8.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:7c046c1d1eeb7aea9335da62472481d3bbf3fd986e093cffd35f4385c94ae368"},
|
|
||||||
{file = "black-24.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:649f6d84ccbae73ab767e206772cc2d7a393a001070a4c814a546afd0d423aed"},
|
|
||||||
{file = "black-24.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2b59b250fdba5f9a9cd9d0ece6e6d993d91ce877d121d161e4698af3eb9c1018"},
|
|
||||||
{file = "black-24.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:6e55d30d44bed36593c3163b9bc63bf58b3b30e4611e4d88a0c3c239930ed5b2"},
|
|
||||||
{file = "black-24.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:505289f17ceda596658ae81b61ebbe2d9b25aa78067035184ed0a9d855d18afd"},
|
|
||||||
{file = "black-24.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b19c9ad992c7883ad84c9b22aaa73562a16b819c1d8db7a1a1a49fb7ec13c7d2"},
|
|
||||||
{file = "black-24.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1f13f7f386f86f8121d76599114bb8c17b69d962137fc70efe56137727c7047e"},
|
|
||||||
{file = "black-24.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:f490dbd59680d809ca31efdae20e634f3fae27fba3ce0ba3208333b713bc3920"},
|
|
||||||
{file = "black-24.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:eab4dd44ce80dea27dc69db40dab62d4ca96112f87996bca68cd75639aeb2e4c"},
|
|
||||||
{file = "black-24.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3c4285573d4897a7610054af5a890bde7c65cb466040c5f0c8b732812d7f0e5e"},
|
|
||||||
{file = "black-24.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9e84e33b37be070ba135176c123ae52a51f82306def9f7d063ee302ecab2cf47"},
|
|
||||||
{file = "black-24.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:73bbf84ed136e45d451a260c6b73ed674652f90a2b3211d6a35e78054563a9bb"},
|
|
||||||
{file = "black-24.8.0-py3-none-any.whl", hash = "sha256:972085c618ee94f402da1af548a4f218c754ea7e5dc70acb168bfaca4c2542ed"},
|
|
||||||
{file = "black-24.8.0.tar.gz", hash = "sha256:2500945420b6784c38b9ee885af039f5e7471ef284ab03fa35ecdde4688cd83f"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.dependencies]
|
|
||||||
click = ">=8.0.0"
|
|
||||||
mypy-extensions = ">=0.4.3"
|
|
||||||
packaging = ">=22.0"
|
|
||||||
pathspec = ">=0.9.0"
|
|
||||||
platformdirs = ">=2"
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
colorama = ["colorama (>=0.4.3)"]
|
|
||||||
d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"]
|
|
||||||
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
|
|
||||||
uvloop = ["uvloop (>=0.15.2)"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfgv"
|
name = "cfgv"
|
||||||
version = "3.4.0"
|
version = "3.4.0"
|
||||||
|
@ -972,4 +928,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.11"
|
python-versions = "^3.11"
|
||||||
content-hash = "ca9188453f62ec4470e2b2f8bc1e4a17ad421272f401328f82d6fede231dc737"
|
content-hash = "eb741020e400664070ed1eee24a17b6a9c07a2f2d44103e4947279aa26a40315"
|
||||||
|
|
|
@ -8,7 +8,6 @@ readme = "README.md"
|
||||||
packages = [{include = "timetracker"}]
|
packages = [{include = "timetracker"}]
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
black = "^24.4.2"
|
|
||||||
mypy = "^1.10.1"
|
mypy = "^1.10.1"
|
||||||
pyyaml = "^6.0.1"
|
pyyaml = "^6.0.1"
|
||||||
pytest = "^8.2.2"
|
pytest = "^8.2.2"
|
||||||
|
|
Loading…
Reference in New Issue