Fix migration
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Lukáš Kucharczyk 2023-01-09 19:09:31 +01:00
parent 97467c7a52
commit 025ea0dd4e
2 changed files with 5 additions and 5 deletions

View File

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

View File

@ -7,16 +7,16 @@ 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)
if session.duration_manual == None:
session.duration_manual = 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
if session.duration_manual == timedelta(0):
session.duration_manual = None
session.save()