Fixing a bug in enum_label that was not working when lookup up an select list from a spreadsheet.
Assure we raise more thoughtful error messages when running getting exceptions in engine tasks. Field Options should always be available now due to a fix in Spiffworkflow.
This commit is contained in:
parent
7041c2285b
commit
4d1f4429ff
|
@ -1238,7 +1238,7 @@
|
|||
},
|
||||
"spiffworkflow": {
|
||||
"git": "https://github.com/sartography/SpiffWorkflow",
|
||||
"ref": "064bf9a23097e961f99ecafc6d52eadc23a046c1"
|
||||
"ref": "e79a3da7a489d12ed8b4666d1b01d9a4a328ba6d"
|
||||
},
|
||||
"sqlalchemy": {
|
||||
"hashes": [
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,6 @@ from crc.models.api_models import WorkflowApiSchema
|
|||
from crc.models.file import FileModel, LookupDataSchema
|
||||
from crc.models.study import StudyModel, WorkflowMetadata, StudyStatus
|
||||
from crc.models.task_event import TaskEventModel, TaskEvent, TaskEventSchema
|
||||
from crc.models.user import UserModelSchema
|
||||
from crc.models.workflow import WorkflowModel, WorkflowSpecModelSchema, WorkflowSpecModel, WorkflowSpecCategoryModel, \
|
||||
WorkflowSpecCategoryModelSchema, WorkflowLibraryModel, WorkflowLibraryModelSchema
|
||||
from crc.services.error_service import ValidationErrorService
|
||||
|
|
|
@ -36,7 +36,9 @@ pet_label = enum_label(task='task_pet_form',field='pet',value='1') // might r
|
|||
print(field)
|
||||
|
||||
if field.type == Task.FIELD_TYPE_AUTO_COMPLETE:
|
||||
return self.autocomplete_label(workflow_model, task_name, field, value)
|
||||
return self.lookup_label(workflow_model, task_name, field, value)
|
||||
elif field.has_property(Task.FIELD_PROP_SPREADSHEET_NAME):
|
||||
return self.lookup_label(workflow_model, task_name, field, value)
|
||||
elif field.type == Task.FIELD_TYPE_ENUM and hasattr(field, 'options'):
|
||||
return self.enum_with_options_label(field, value)
|
||||
elif field.has_property(Task.FIELD_PROP_DATA_NAME):
|
||||
|
@ -53,8 +55,7 @@ pet_label = enum_label(task='task_pet_form',field='pet',value='1') // might r
|
|||
raise ApiError("invalid_spec",
|
||||
f"Unable to find a task in the workflow called '{task_name}'")
|
||||
|
||||
|
||||
def autocomplete_label(self, workflow_model, task_name, field, value):
|
||||
def lookup_label(self, workflow_model, task_name, field, value):
|
||||
label_column = field.get_property(Task.FIELD_PROP_LABEL_COLUMN)
|
||||
result = LookupService().lookup(workflow_model, task_name, field.id, '', value=value, limit=1)
|
||||
if len(result) > 0:
|
||||
|
|
|
@ -358,13 +358,13 @@ class WorkflowProcessor(object):
|
|||
self.bpmn_workflow.refresh_waiting_tasks()
|
||||
self.bpmn_workflow.do_engine_steps(exit_at = exit_at)
|
||||
except WorkflowTaskExecException as we:
|
||||
raise ApiError.from_task("task_error", str(we), we.task)
|
||||
raise ApiError.from_workflow_exception("task_error", str(we), we)
|
||||
|
||||
def cancel_notify(self):
|
||||
try:
|
||||
self.bpmn_workflow.cancel_notify()
|
||||
except WorkflowTaskExecException as we:
|
||||
raise ApiError.from_task("task_error", str(we), we.task)
|
||||
raise ApiError.from_workflow_exception("task_error", str(we), we)
|
||||
|
||||
def serialize(self):
|
||||
return self._serializer.serialize_workflow(self.bpmn_workflow,include_spec=True)
|
||||
|
|
|
@ -789,8 +789,6 @@ class WorkflowService(object):
|
|||
if field.has_property(Task.FIELD_PROP_SPREADSHEET_NAME):
|
||||
lookup_model = LookupService.get_lookup_model(spiff_task, field)
|
||||
data = db.session.query(LookupDataModel).filter(LookupDataModel.lookup_file_model == lookup_model).all()
|
||||
if not hasattr(field, 'options'):
|
||||
field.options = []
|
||||
for d in data:
|
||||
field.add_option(d.value, d.label)
|
||||
elif field.has_property(Task.FIELD_PROP_DATA_NAME):
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
2021-11-16 11:39:17,159 - apscheduler.scheduler - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts
|
||||
2021-11-16 11:39:17,159 - apscheduler.scheduler - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts
|
||||
2021-11-16 11:39:17,160 - apscheduler.scheduler - INFO - Added job "process_waiting_tasks" to job store "default"
|
||||
2021-11-16 11:39:17,160 - apscheduler.scheduler - INFO - Added job "FileService.cleanup_file_data" to job store "default"
|
||||
2021-11-16 11:39:17,160 - apscheduler.scheduler - INFO - Scheduler started
|
Loading…
Reference in New Issue