diff --git a/CHANGELOG.md b/CHANGELOG.md index 760e7ef..d7e2acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## Unreleased +* Make the "Finish now?" button on session list work * Hide navigation bar items if there are no games/purchases/sessions * Set default version to "git-main" to indicate development environment * Add homepage, link to it from the logo diff --git a/Dockerfile b/Dockerfile index 2f0905c..5b2f517 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,5 @@ COPY entrypoint.sh / RUN chmod +x /entrypoint.sh USER timetracker EXPOSE 8000 -ENV VERSION_NUMBER 0.1.0-4-g166dd71 +ENV VERSION_NUMBER 0.1.0-14-g61d2e65 ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/src/web/common/util/__init__.py b/src/web/common/util/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/web/common/util/time.py b/src/web/common/util/time.py new file mode 100644 index 0000000..57c8885 --- /dev/null +++ b/src/web/common/util/time.py @@ -0,0 +1,7 @@ +from datetime import datetime +from django.conf import settings +from zoneinfo import ZoneInfo + + +def now(): + return datetime.now(ZoneInfo(settings.TIME_ZONE)) diff --git a/src/web/tracker/models.py b/src/web/tracker/models.py index a6c421f..a129c72 100644 --- a/src/web/tracker/models.py +++ b/src/web/tracker/models.py @@ -1,5 +1,7 @@ from django.db import models -from datetime import timedelta +from datetime import datetime +from django.conf import settings +from zoneinfo import ZoneInfo class Game(models.Model): @@ -40,6 +42,9 @@ class Session(models.Model): mark = ", manual" if self.duration_manual != None else "" return f"{str(self.purchase)} {str(self.timestamp_start.date())} ({self.duration_any()}{mark})" + def finish_now(self): + self.timestamp_end = datetime.now(ZoneInfo(settings.TIME_ZONE)) + def duration_seconds(self): if self.timestamp_end == None or self.timestamp_start == None: if self.duration_manual == None: diff --git a/src/web/tracker/static/base.css b/src/web/tracker/static/base.css index 0e7b594..dfd4ac6 100644 --- a/src/web/tracker/static/base.css +++ b/src/web/tracker/static/base.css @@ -819,11 +819,6 @@ select { border-color: rgb(229 231 235 / var(--tw-border-opacity)); } -.border-red-800 { - --tw-border-opacity: 1; - border-color: rgb(153 27 27 / var(--tw-border-opacity)); -} - .border-red-900 { --tw-border-opacity: 1; border-color: rgb(127 29 29 / var(--tw-border-opacity)); @@ -943,21 +938,6 @@ form input[type=submit] { border-color: rgb(255 255 255 / var(--tw-border-opacity)); } -.hover\:bg-red-600:hover { - --tw-bg-opacity: 1; - background-color: rgb(220 38 38 / var(--tw-bg-opacity)); -} - -.hover\:bg-red-500:hover { - --tw-bg-opacity: 1; - background-color: rgb(239 68 68 / var(--tw-bg-opacity)); -} - -.hover\:bg-yellow-700:hover { - --tw-bg-opacity: 1; - background-color: rgb(161 98 7 / var(--tw-bg-opacity)); -} - .hover\:bg-orange-700:hover { --tw-bg-opacity: 1; background-color: rgb(194 65 12 / var(--tw-bg-opacity)); diff --git a/src/web/tracker/templates/list_sessions.html b/src/web/tracker/templates/list_sessions.html index 3e78c21..270b0de 100644 --- a/src/web/tracker/templates/list_sessions.html +++ b/src/web/tracker/templates/list_sessions.html @@ -19,7 +19,7 @@