Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
steering
Commits
b9d2b84d
Commit
b9d2b84d
authored
3 years ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
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
3 years ago
Stage: release
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/views.py
+7
-5
7 additions, 5 deletions
program/views.py
with
7 additions
and
5 deletions
program/views.py
+
7
−
5
View file @
b9d2b84d
...
@@ -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
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment