diff --git a/Dockerfile b/Dockerfile index ed13576..a7a6de3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ RUN git clone https://git.kucharczyk.xyz/lukas/timetracker.git /home/timetracker WORKDIR /home/timetracker/app RUN chown -R timetracker /home/timetracker/app RUN poetry install +RUN make initialize EXPOSE 8000 USER timetracker CMD [ "python3", "src/web/manage.py", "runserver", "0.0.0.0:8000" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 37f714c..f3b202b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,12 @@ +.PHONY: createsuperuser + all: css migrate initialize: css migrate loadplatforms -css: src\input.css src\web\tracker\templates\*.html +HTMLFILES := $(shell find src\web\tracker\templates -type f) + +css: src\input.css $(HTMLFILES) npx tailwindcss -i .\src\input.css -o .\src\web\tracker\static\base.css css-dev: css @@ -24,4 +28,7 @@ loadplatforms: python src\web\manage.py loaddata platforms.yaml loadsample: - python src\web\manage.py loaddata sample.yaml \ No newline at end of file + python src\web\manage.py loaddata sample.yaml + +createsuperuser: + python src\web\manage.py createsuperuser \ No newline at end of file diff --git a/src/web/tracker/migrations/0002_alter_session_duration_manual.py b/src/web/tracker/migrations/0002_alter_session_duration_manual.py new file mode 100644 index 0000000..1411fd4 --- /dev/null +++ b/src/web/tracker/migrations/0002_alter_session_duration_manual.py @@ -0,0 +1,21 @@ +# Generated by Django 4.1.4 on 2023-01-02 18:55 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("tracker", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="session", + name="duration_manual", + field=models.DurationField( + blank=True, default=datetime.timedelta(0), null=True + ), + ), + ] diff --git a/src/web/tracker/migrations/0003_alter_session_duration_manual_and_more.py b/src/web/tracker/migrations/0003_alter_session_duration_manual_and_more.py new file mode 100644 index 0000000..8eeb1b1 --- /dev/null +++ b/src/web/tracker/migrations/0003_alter_session_duration_manual_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.1.4 on 2023-01-02 23:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("tracker", "0002_alter_session_duration_manual"), + ] + + operations = [ + migrations.AlterField( + model_name="session", + name="duration_manual", + field=models.DurationField(blank=True, null=True), + ), + migrations.AlterField( + model_name="session", + name="timestamp_end", + field=models.DateTimeField(blank=True, null=True), + ), + ] diff --git a/src/web/tracker/models.py b/src/web/tracker/models.py index 8ac5375..30f9811 100644 --- a/src/web/tracker/models.py +++ b/src/web/tracker/models.py @@ -31,8 +31,8 @@ class Platform(models.Model): class Session(models.Model): purchase = models.ForeignKey("Purchase", on_delete=models.CASCADE) timestamp_start = models.DateTimeField() - timestamp_end = models.DateTimeField() - duration_manual = models.DurationField(blank=True, null=True, default=timedelta(0)) + timestamp_end = models.DateTimeField(blank=True, null=True) + duration_manual = models.DurationField(blank=True, null=True) duration_calculated = models.DurationField(blank=True, null=True) note = models.TextField(blank=True, null=True)