Compare commits

...

2 Commits

Author SHA1 Message Date
Lukáš Kucharczyk 97467c7a52 Also set duration_manual to zero
continuous-integration/drone/push Build is passing Details
2023-01-09 19:05:47 +01:00
Lukáš Kucharczyk 7842d6f45d Remove debugging statement 2023-01-09 19:00:03 +01:00
3 changed files with 36 additions and 2 deletions

View File

@ -6,7 +6,7 @@ RUN npm install && \
FROM python:3.10.9-alpine FROM python:3.10.9-alpine
ENV VERSION_NUMBER 0.1.2-7-g24f4459 ENV VERSION_NUMBER 0.1.2-9-g7842d6f
ENV PROD 1 ENV PROD 1
RUN apk add \ RUN apk add \

View File

@ -0,0 +1,34 @@
# Generated by Django 4.1.5 on 2023-01-09 18:04
from django.db import migrations
from datetime import timedelta
def set_duration_manual_none_to_zero(apps, schema_editor):
Session = apps.get_model("tracker", "Session")
for session in Session.objects.all():
if session.duration_calculated == None:
session.duration_calculated = timedelta(0)
session.save()
def revert_set_duration_manual_none_to_zero(apps, schema_editor):
Session = apps.get_model("tracker", "Session")
for session in Session.objects.all():
if session.duration_calculated == timedelta(0):
session.duration_calculated = None
session.save()
class Migration(migrations.Migration):
dependencies = [
("tracker", "0005_auto_20230109_1843"),
]
operations = [
migrations.RunPython(
set_duration_manual_none_to_zero,
revert_set_duration_manual_none_to_zero,
)
]

View File

@ -5,7 +5,7 @@
{% block content %} {% block content %}
{% if purchase %} {% if purchase %}
<div class="text-center text-xl mb-4 dark:text-slate-400"> <div class="text-center text-xl mb-4 dark:text-slate-400">
<h1>Listing sessions only for purchaseee "{{ purchase }}" (total playtime: {{ total_duration }})</h1> <h1>Listing sessions only for purchase "{{ purchase }}" (total playtime: {{ total_duration }})</h1>
<a class="dark:text-white hover:underline" href="{% url 'list_sessions' %}">View all sessions</a> <a class="dark:text-white hover:underline" href="{% url 'list_sessions' %}">View all sessions</a>
</div> </div>
{% endif %} {% endif %}