Skip to content

Commit

Permalink
Make sure duration is multiple of 5 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
johanvdw committed Dec 16, 2024
1 parent d5b30b2 commit 888e709
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pretalx/orga/views/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,14 @@ def patch(self, request, event, pk):
if not talk:
return JsonResponse({"error": "Talk not found"})
data = json.loads(request.body.decode())
print(data)
if data.get("start"):
duration = talk.duration
talk.start = dateutil.parser.parse(data.get("start"))
if data.get("end"):
talk.end = dateutil.parser.parse(data["end"])
duration = (talk.end - talk.start).total_seconds() / 60
if duration % 5 !=0:
return JsonResponse({"error": "Duration must me multiple of 5"})
elif data.get("duration"):
if data.get("duration") %5 != 0:
return JsonResponse({"error": "Duration must me multiple of 5"})
Expand Down

0 comments on commit 888e709

Please sign in to comment.