From 045b65730616f120d306ae7730ce18fe01615262 Mon Sep 17 00:00:00 2001 From: Stefan Koegl Date: Sun, 5 Sep 2010 17:32:50 +0200 Subject: [PATCH] prevent episode playmark events without total time (bug 1136) --- mygpo/api/advanced/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mygpo/api/advanced/__init__.py b/mygpo/api/advanced/__init__.py index d23b50b3..b5570726 100644 --- a/mygpo/api/advanced/__init__.py +++ b/mygpo/api/advanced/__init__.py @@ -307,6 +307,11 @@ def update_episodes(user, actions): time_values['position'] is None: return HttpResponseBadRequest('started and total require position') + # Sanity check: total and position can only appear together + if (time_values['total'] or time_values['started']) and \ + not (time_values['total'] and time_values['started']): + return HttpResponseBadRequest('total and started parameters can only appear together') + try: EpisodeAction.objects.create(user=user, episode=episode, device=device, action=action, timestamp=timestamp, playmark=time_values['position'], started=time_values['started'], total=time_values['total']) -- 2.11.4.GIT