Don't let updates to workflow-spec and workflow-spec-category metadata change the display_order
Force display_order changes to use the new reorder API endpoints
This commit is contained in:
parent
f6816a2e42
commit
994ce4008f
|
@ -104,6 +104,7 @@ def validate_workflow_specification(spec_id, study_id=None, test_until=None):
|
||||||
return ApiErrorSchema(many=True).dump([error])
|
return ApiErrorSchema(many=True).dump([error])
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def update_workflow_specification(spec_id, body):
|
def update_workflow_specification(spec_id, body):
|
||||||
if spec_id is None:
|
if spec_id is None:
|
||||||
raise ApiError('unknown_spec', 'Please provide a valid Workflow Spec ID.')
|
raise ApiError('unknown_spec', 'Please provide a valid Workflow Spec ID.')
|
||||||
|
@ -112,6 +113,10 @@ def update_workflow_specification(spec_id, body):
|
||||||
if spec is None:
|
if spec is None:
|
||||||
raise ApiError('unknown_study', 'The spec "' + spec_id + '" is not recognized.')
|
raise ApiError('unknown_study', 'The spec "' + spec_id + '" is not recognized.')
|
||||||
|
|
||||||
|
# Make sure they don't try to change the display_order
|
||||||
|
# There is a separate endpoint for this
|
||||||
|
body['display_order'] = spec.display_order
|
||||||
|
|
||||||
schema = WorkflowSpecModelSchema()
|
schema = WorkflowSpecModelSchema()
|
||||||
spec = schema.load(body, session=session, instance=spec, partial=True)
|
spec = schema.load(body, session=session, instance=spec, partial=True)
|
||||||
session.add(spec)
|
session.add(spec)
|
||||||
|
@ -334,6 +339,10 @@ def update_workflow_spec_category(cat_id, body):
|
||||||
if category is None:
|
if category is None:
|
||||||
raise ApiError('unknown_category', 'The category "' + cat_id + '" is not recognized.')
|
raise ApiError('unknown_category', 'The category "' + cat_id + '" is not recognized.')
|
||||||
|
|
||||||
|
# Make sure they don't try to change the display_order
|
||||||
|
# There is a separate endpoint for that
|
||||||
|
body['display_order'] = category.display_order
|
||||||
|
|
||||||
schema = WorkflowSpecCategoryModelSchema()
|
schema = WorkflowSpecCategoryModelSchema()
|
||||||
category = schema.load(body, session=session, instance=category, partial=True)
|
category = schema.load(body, session=session, instance=category, partial=True)
|
||||||
session.add(category)
|
session.add(category)
|
||||||
|
|
Loading…
Reference in New Issue