Skip to content
Snippets Groups Projects
Commit b9d2b84d authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Don't respond with status codes the dashboard can't handle

parent 88d3af01
No related branches found
No related tags found
No related merge requests found
Pipeline #1672 passed
...@@ -417,9 +417,9 @@ class APIScheduleViewSet(viewsets.ModelViewSet): ...@@ -417,9 +417,9 @@ class APIScheduleViewSet(viewsets.ModelViewSet):
# First create submit -> return projected timeslots and collisions # First create submit -> return projected timeslots and collisions
# TODO: Perhaps directly insert into database if no conflicts found # TODO: Perhaps directly insert into database if no conflicts found
if "solutions" not in request.data: if "solutions" not in request.data:
# TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it
return Response( return Response(
Schedule.make_conflicts(request.data["schedule"], pk, show_pk), Schedule.make_conflicts(request.data["schedule"], pk, show_pk),
status=status.HTTP_409_CONFLICT,
) )
# Otherwise try to resolve # Otherwise try to resolve
...@@ -430,7 +430,8 @@ class APIScheduleViewSet(viewsets.ModelViewSet): ...@@ -430,7 +430,8 @@ class APIScheduleViewSet(viewsets.ModelViewSet):
return Response(resolution, status=status.HTTP_201_CREATED) return Response(resolution, status=status.HTTP_201_CREATED)
# Otherwise return conflicts # Otherwise return conflicts
return Response(resolution, status=status.HTTP_409_CONFLICT) # TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it
return Response(resolution)
def update(self, request, *args, **kwargs): def update(self, request, *args, **kwargs):
""" """
...@@ -471,9 +472,9 @@ class APIScheduleViewSet(viewsets.ModelViewSet): ...@@ -471,9 +472,9 @@ class APIScheduleViewSet(viewsets.ModelViewSet):
# First update submit -> return projected timeslots and collisions # First update submit -> return projected timeslots and collisions
if "solutions" not in request.data: if "solutions" not in request.data:
# TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it
return Response( return Response(
Schedule.make_conflicts(request.data["schedule"], pk, show_pk), Schedule.make_conflicts(request.data["schedule"], pk, show_pk)
status=status.HTTP_409_CONFLICT,
) )
# Otherwise try to resolve # Otherwise try to resolve
...@@ -484,7 +485,8 @@ class APIScheduleViewSet(viewsets.ModelViewSet): ...@@ -484,7 +485,8 @@ class APIScheduleViewSet(viewsets.ModelViewSet):
return Response(resolution) return Response(resolution)
# Otherwise return conflicts # Otherwise return conflicts
return Response(resolution, status=status.HTTP_409_CONFLICT) # TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it
return Response(resolution)
def destroy(self, request, *args, **kwargs): def destroy(self, request, *args, **kwargs):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment