mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Clean up display_order numbers when reordering.
This fixes the problem where we have don't have all unique display_order numbers. I.e., 0, 1, 1, 3, 5
This commit is contained in:
parent
86583aa2d6
commit
9bd012c822
@ -161,6 +161,7 @@ def reorder_workflow_specification(spec_id, direction):
|
|||||||
message='The direction must be `up` or `down`.')
|
message='The direction must be `up` or `down`.')
|
||||||
spec = session.query(WorkflowSpecModel).filter(WorkflowSpecModel.id == spec_id).first()
|
spec = session.query(WorkflowSpecModel).filter(WorkflowSpecModel.id == spec_id).first()
|
||||||
if spec:
|
if spec:
|
||||||
|
WorkflowService.cleanup_workflow_spec_display_order(spec.category_id)
|
||||||
ordered_specs = WorkflowService.reorder_workflow_spec(spec, direction)
|
ordered_specs = WorkflowService.reorder_workflow_spec(spec, direction)
|
||||||
else:
|
else:
|
||||||
raise ApiError(code='bad_spec_id',
|
raise ApiError(code='bad_spec_id',
|
||||||
@ -366,6 +367,7 @@ def reorder_workflow_spec_category(cat_id, direction):
|
|||||||
if direction not in ('up', 'down'):
|
if direction not in ('up', 'down'):
|
||||||
raise ApiError(code='bad_direction',
|
raise ApiError(code='bad_direction',
|
||||||
message='The direction must be `up` or `down`.')
|
message='The direction must be `up` or `down`.')
|
||||||
|
WorkflowService.cleanup_workflow_spec_category_display_order()
|
||||||
category = session.query(WorkflowSpecCategoryModel).\
|
category = session.query(WorkflowSpecCategoryModel).\
|
||||||
filter(WorkflowSpecCategoryModel.id == cat_id).first()
|
filter(WorkflowSpecCategoryModel.id == cat_id).first()
|
||||||
if category:
|
if category:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user