Compare commits

..

No commits in common. "6e4db38ee4d81fdf8443e586b8f9fc6c4fa56f12" and "eec8f1b9f59e945f9624d53028f1b73df48e935d" have entirely different histories.

7 changed files with 27 additions and 108 deletions

View File

@ -1,15 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
form label {
@apply dark:text-slate-400;
}
form input,select,textarea {
@apply dark:bg-slate-500 dark:border dark:border-slate-900 dark:text-slate-100;
}
form input[type=submit] {
@apply p-2 bg-purple-900;
}

View File

@ -742,10 +742,6 @@ select {
display: grid;
}
.h-screen {
height: 100vh;
}
.w-full {
width: 100%;
}
@ -829,10 +825,6 @@ select {
padding-right: 1rem;
}
.text-center {
text-align: center;
}
.text-4xl {
font-size: 2.25rem;
line-height: 2.5rem;
@ -863,27 +855,6 @@ select {
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
.dark form label {
--tw-text-opacity: 1;
color: rgb(148 163 184 / var(--tw-text-opacity));
}
.dark form input,.dark select,.dark textarea {
border-width: 1px;
--tw-border-opacity: 1;
border-color: rgb(15 23 42 / var(--tw-border-opacity));
--tw-bg-opacity: 1;
background-color: rgb(100 116 139 / var(--tw-bg-opacity));
--tw-text-opacity: 1;
color: rgb(241 245 249 / var(--tw-text-opacity));
}
form input[type=submit] {
--tw-bg-opacity: 1;
background-color: rgb(88 28 135 / var(--tw-bg-opacity));
padding: 0.5rem;
}
.hover\:underline:hover {
text-decoration-line: underline;
}
@ -893,11 +864,6 @@ form input[type=submit] {
border-color: rgb(255 255 255 / var(--tw-border-opacity));
}
.dark .dark\:bg-gray-800 {
--tw-bg-opacity: 1;
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
}
.dark .dark\:bg-gray-900 {
--tw-bg-opacity: 1;
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
@ -908,9 +874,9 @@ form input[type=submit] {
background-color: rgb(51 65 85 / var(--tw-bg-opacity));
}
.dark .dark\:text-white {
.dark .dark\:text-slate-300 {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
color: rgb(203 213 225 / var(--tw-text-opacity));
}
.dark .dark\:text-slate-400 {
@ -918,11 +884,6 @@ form input[type=submit] {
color: rgb(148 163 184 / var(--tw-text-opacity));
}
.dark .dark\:text-slate-300 {
--tw-text-opacity: 1;
color: rgb(203 213 225 / var(--tw-text-opacity));
}
@media (min-width: 768px) {
.md\:block {
display: block;

View File

@ -6,13 +6,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Timetracker - {% block title %}Untitled{% endblock title %}</title>
<title>{% block title %}No Title{% endblock title %}</title>
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
<link rel="stylesheet" href="{% static 'base.css' %}" />
</head>
<body class="dark">
<div class="dark:bg-gray-800 h-screen">
<nav class="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded">
<div class="container flex flex-wrap items-center justify-between mx-auto">
<a href="#" class="flex items-center">
@ -21,7 +20,7 @@
</a>
<div class="w-full md:block md:w-auto">
<ul
class="flex flex-col md:flex-row p-4 mt-4 dark:text-white">
class="flex flex-col md:flex-row p-4 mt-4">
<li><a class="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_game' %}">New Game</a></li>
<li><a class="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_purchase' %}">New Purchase</a></li>
<li><a class="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_session' %}">New Session</a></li>
@ -31,7 +30,6 @@
</div>
</nav>
{% block content %}No content here.{% endblock %}
</div>
</body>
</html>

View File

@ -1,23 +1,17 @@
{% extends 'base.html' %}
{% block title %}Sessions{% endblock title %}
{% block title %}Tracker Entry List{% endblock title %}
{% block content %}
{% if purchase %}
<div class="text-center text-xl mb-4 dark:text-slate-400">
<h1>Listing sessions only for purchase "{{ purchase }}"</h1>
<a class="dark:text-white hover:underline" href="{% url 'list_sessions' %}">View all sessions</a>
</div>
{% endif %}
<div class="grid grid-cols-4 gap-4 shadow rounded-xl max-w-screen-lg mx-auto dark:bg-slate-700 p-2 justify-center">
<div class="dark:border-white dark:text-slate-300 text-lg">Name</div>
<div class="dark:border-white dark:text-slate-300 text-lg">Start</div>
<div class="dark:border-white dark:text-slate-300 text-lg">End</div>
<div class="dark:border-white dark:text-slate-300 text-lg">Duration</div>
{% for data in dataset %}
<div class=""><a class="dark:text-white hover:underline" href="{% url 'list_sessions' data.purchase.id %}">{{ data.purchase }}</a></div>
<div class="dark:text-slate-400">{{ data.timestamp_start | date:"d/m/Y H:i" }}</div>
<div class="dark:text-slate-400">{{ data.timestamp_end | date:"d/m/Y H:i" }}</div>
<div class="dark:text-slate-400">{{ data.purchase }}</div>
<div class="dark:text-slate-400">{{ data.timestamp_start }}</div>
<div class="dark:text-slate-400">{{ data.timestamp_end }}</div>
<div class="dark:text-slate-400">{{ data.time_delta }}</div>
{% endfor %}
</div>

View File

@ -7,9 +7,4 @@ urlpatterns = [
path("add-session/", views.add_session, name="add_session"),
path("add-purchase/", views.add_purchase, name="add_purchase"),
path("list-sessions/", views.list_sessions, name="list_sessions"),
path(
"list-sessions/by-purchase/<int:purchase_id>",
views.list_sessions,
name="list_sessions",
),
]

View File

@ -4,7 +4,6 @@ from .models import Game, Platform, Purchase, Session
from .forms import SessionForm, PurchaseForm, GameForm
from datetime import datetime
from django.db.models import ExpressionWrapper, F, DurationField
import logging
def add_session(request):
@ -19,16 +18,9 @@ def add_session(request):
return render(request, "add_session.html", context)
def list_sessions(request, purchase_id=None):
def list_sessions(request):
context = {}
if purchase_id != None:
dataset = Session.objects.filter(purchase=purchase_id)
context["purchase"] = Purchase.objects.get(id=purchase_id)
else:
dataset = Session.objects.all()
dataset = dataset.annotate(
dataset = Session.objects.annotate(
time_delta=ExpressionWrapper(
F("timestamp_end") - F("timestamp_start"), output_field=DurationField()
)

View File

@ -11,7 +11,6 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
"""
from pathlib import Path
import logging
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -123,11 +122,3 @@ STATIC_URL = "static/"
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# https://docs.djangoproject.com/en/4.1/topics/logging/
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {"console": {"class": "logging.StreamHandler"}},
"root": {"handlers": ["console"], "level": "WARNING"},
}