save changes before refactor
This commit is contained in:
parent
e377a05dea
commit
a8203ed01d
|
@ -12,7 +12,7 @@ JSON_SORT_KEYS = False # CRITICAL. Do not sort the data when returning values
|
|||
# you may want to change this to something simple for testing!!
|
||||
# NB, if you change this in the local endpoint,
|
||||
# it needs to be changed in the remote endpoint as well
|
||||
API_TOKEN = 'af95596f327c9ecc007b60414fc84b61'
|
||||
API_TOKEN = environ.get('API_TOKEN', default = 'af95596f327c9ecc007b60414fc84b61')
|
||||
|
||||
NAME = "CR Connect Workflow"
|
||||
FLASK_PORT = environ.get('PORT0') or environ.get('FLASK_PORT', default="5000")
|
||||
|
|
|
@ -352,8 +352,17 @@ def sync_changed_files(remote,workflow_spec_id):
|
|||
if specdict['category'] == None:
|
||||
localspec.category = None
|
||||
else:
|
||||
localspec.category = session.query(WorkflowSpecCategoryModel).filter(WorkflowSpecCategoryModel.id
|
||||
== specdict['category']['id']).first()
|
||||
localcategory = session.query(WorkflowSpecCategoryModel).filter(WorkflowSpecCategoryModel.name
|
||||
== specdict['category']['name']).first()
|
||||
if localcategory == None:
|
||||
#category doesn't exist - lets make it
|
||||
localcategory = WorkflowSpecCategoryModel()
|
||||
localcategory.name = specdict['category']['name']
|
||||
localcategory.display_name = specdict['category']['display_name']
|
||||
localcategory.display_order = specdict['category']['display_order']
|
||||
session.add(localcategory)
|
||||
localspec.category = localcategory
|
||||
|
||||
localspec.display_order = specdict['display_order']
|
||||
localspec.display_name = specdict['display_name']
|
||||
localspec.name = specdict['name']
|
||||
|
@ -372,7 +381,12 @@ def sync_changed_files(remote,workflow_spec_id):
|
|||
for delfile in deletefiles:
|
||||
currentfile = session.query(FileModel).filter(FileModel.workflow_spec_id==workflow_spec_id,
|
||||
FileModel.name == delfile['filename']).first()
|
||||
FileService.delete_file(currentfile.id)
|
||||
|
||||
# it is more appropriate to archive the file than delete
|
||||
# due to the fact that we might have workflows that are using the
|
||||
# file data
|
||||
currentfile.archived = True
|
||||
session.add(currentfile)
|
||||
|
||||
for updatefile in updatefiles:
|
||||
currentfile = session.query(FileModel).filter(FileModel.workflow_spec_id==workflow_spec_id,
|
||||
|
|
|
@ -67,6 +67,7 @@ class ExampleDataLoader:
|
|||
display_order=6
|
||||
),
|
||||
]
|
||||
db.session.execute("select setval('workflow_spec_category_id_seq',7);")
|
||||
db.session.add_all(categories)
|
||||
db.session.commit()
|
||||
|
||||
|
|
Loading…
Reference in New Issue