mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
getting default display_order working correctly
This commit is contained in:
parent
25ecc1593a
commit
f1a75ca6bf
@ -45,6 +45,13 @@ class FileSystemService(object):
|
||||
category_path = FileSystemService.category_path(spec.category_id)
|
||||
return os.path.join(category_path, spec.display_name)
|
||||
|
||||
def next_display_order(self, spec):
|
||||
path = self.category_path(spec.category_id)
|
||||
if os.path.exists(path):
|
||||
return len(next(os.walk(path))[1])
|
||||
else:
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def write_file_data_to_system(file_path, file_data):
|
||||
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
||||
|
@ -29,7 +29,7 @@ class WorkflowSpecService(FileSystemService):
|
||||
self.scan_file_system()
|
||||
|
||||
def add_spec(self, spec: WorkflowSpecInfo):
|
||||
display_order = len(self.categories[spec.category_id].len)
|
||||
display_order = self.next_display_order(spec)
|
||||
spec.display_order = display_order
|
||||
self.update_spec(spec)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user