mirror of
https://github.com/sartography/spiffworkflow-backend.git
synced 2025-02-23 12:58:13 +00:00
rename function to make sense
This commit is contained in:
parent
138799941d
commit
611632388d
@ -878,10 +878,10 @@ def process_instance_task_list(
|
||||
|
||||
|
||||
# originally from: https://bitcoden.com/answers/python-nested-dictionary-update-value-where-any-nested-key-matches
|
||||
def update_nested(task_data: dict, in_dict: dict, key: str) -> None:
|
||||
def update_form_schema_with_task_data_as_needed(in_dict: dict, task_data: dict) -> None:
|
||||
"""Update_nested."""
|
||||
for k, value in in_dict.items():
|
||||
if key == k:
|
||||
if "anyOf" == k:
|
||||
# value will look like the array on the right of "anyOf": ["options_from_task_data_var:awesome_options"]
|
||||
if value.__class__.__name__ == "list":
|
||||
if len(value) == 1:
|
||||
@ -914,11 +914,11 @@ def update_nested(task_data: dict, in_dict: dict, key: str) -> None:
|
||||
|
||||
in_dict[k] = options_for_react_json_schema_form
|
||||
elif isinstance(value, dict):
|
||||
update_nested(task_data, value, key)
|
||||
update_form_schema_with_task_data_as_needed(value, task_data)
|
||||
elif isinstance(value, list):
|
||||
for o in value:
|
||||
if isinstance(o, dict):
|
||||
update_nested(task_data, o, key)
|
||||
update_form_schema_with_task_data_as_needed(o, task_data)
|
||||
|
||||
|
||||
def task_show(process_instance_id: int, task_id: str) -> flask.wrappers.Response:
|
||||
@ -983,11 +983,9 @@ def task_show(process_instance_id: int, task_id: str) -> flask.wrappers.Response
|
||||
form_dict = json.loads(form_contents)
|
||||
|
||||
if task.data:
|
||||
update_nested(task.data, form_dict, "anyOf")
|
||||
update_form_schema_with_task_data_as_needed(form_dict, task.data)
|
||||
|
||||
if form_contents:
|
||||
# task.form_schema = form_contents
|
||||
# task.form_schema = json.dumps(form_dict)
|
||||
task.form_schema = form_dict
|
||||
|
||||
if form_ui_schema_file_name:
|
||||
|
@ -985,7 +985,6 @@ class TestProcessApi(BaseTest):
|
||||
)
|
||||
assert len(active_tasks) == 1
|
||||
active_task = active_tasks[0]
|
||||
print(f"active_task.task_id: {active_task.task_id}")
|
||||
response = client.get(
|
||||
f"/v1.0/tasks/{process_instance_id}/{active_task.task_id}",
|
||||
headers=self.logged_in_headers(user),
|
||||
@ -995,7 +994,6 @@ class TestProcessApi(BaseTest):
|
||||
response.json["form_schema"]["definitions"]["Color"]["anyOf"][1]["title"]
|
||||
== "Green"
|
||||
)
|
||||
print(f"response.json: {response.json}")
|
||||
|
||||
def test_process_instance_list_with_default_list(
|
||||
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None
|
||||
|
Loading…
x
Reference in New Issue
Block a user