From 18e8f932618afd1a41ce58d7c4f8ec313fd99791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Fri, 20 Jan 2023 15:06:42 +0100 Subject: [PATCH] Additional fixes --- Caddyfile | 2 +- Dockerfile | 4 ++-- input.css => common/input.css | 0 entrypoint.sh | 4 ++-- games/views.py | 3 ++- tailwind.config.js | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) rename input.css => common/input.css (100%) diff --git a/Caddyfile b/Caddyfile index f95bb91..0ed6e2b 100644 --- a/Caddyfile +++ b/Caddyfile @@ -5,7 +5,7 @@ :8000 { handle_path /static/* { - root * src/timetracker/static/ + root * static/ file_server } handle { diff --git a/Dockerfile b/Dockerfile index 76897b7..a266a7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node as css WORKDIR /app COPY . /app RUN npm install && \ - npx tailwindcss -i ./src/input.css -o ./src/timetracker/games/static/base.css --minify + npx tailwindcss -i ./common/input.css -o ./static/base.css --minify FROM python:3.10.9-slim-bullseye @@ -26,7 +26,7 @@ RUN useradd -m --uid 1000 timetracker WORKDIR /home/timetracker/app COPY . /home/timetracker/app/ RUN chown -R timetracker:timetracker /home/timetracker/app -COPY --from=css /app/src/timetracker/games/static/base.css /home/timetracker/app/src/timetracker/games/static/base.css +COPY --from=css ./app/static/base.css /home/timetracker/app/static/base.css COPY entrypoint.sh / RUN chmod +x /entrypoint.sh diff --git a/input.css b/common/input.css similarity index 100% rename from input.css rename to common/input.css diff --git a/entrypoint.sh b/entrypoint.sh index b75c21a..6adac62 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,10 +2,10 @@ # Apply database migrations set -euo pipefail echo "Apply database migrations" -poetry run python src/timetracker/manage.py migrate +poetry run python manage.py migrate echo "Collect static files" -poetry run python src/timetracker/manage.py collectstatic --clear --no-input +poetry run python manage.py collectstatic --clear --no-input echo "Starting server" caddy start diff --git a/games/views.py b/games/views.py index 3e42709..48729c9 100644 --- a/games/views.py +++ b/games/views.py @@ -85,7 +85,8 @@ def list_sessions(request, filter="", purchase_id="", platform_id="", game_id="" # cannot use dataset[0] here because that might be only partial QuerySet context["last"] = Session.objects.all().order_by("timestamp_start").last() # charts are always oldest->newest - context["chart"] = playtime_over_time_chart(dataset.order_by("timestamp_start")) + if Session.objects.count() >= 2: + context["chart"] = playtime_over_time_chart(dataset.order_by("timestamp_start")) return render(request, "list_sessions.html", context) diff --git a/tailwind.config.js b/tailwind.config.js index 864d90a..62d044f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,6 +1,6 @@ module.exports = { darkMode: 'class', - content: ["./src/**/*.{html,js}"], + content: ["./**/*.{html,js}"], theme: { fontFamily: { sans: ['Inter', 'sans-serif'],