mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-02-05 06:04:32 +00:00
Support reporting on task data (#47)
This commit is contained in:
parent
68130b216d
commit
5786c8d83c
@ -811,18 +811,12 @@ def process_instance_list(
|
|||||||
ProcessInstanceModel.start_in_seconds.desc(), ProcessInstanceModel.id.desc() # type: ignore
|
ProcessInstanceModel.start_in_seconds.desc(), ProcessInstanceModel.id.desc() # type: ignore
|
||||||
).paginate(page=page, per_page=per_page, error_out=False)
|
).paginate(page=page, per_page=per_page, error_out=False)
|
||||||
|
|
||||||
# TODO need to look into test failures when the results from result_dict is
|
results = list(
|
||||||
# used instead of the process instances
|
map(
|
||||||
|
ProcessInstanceService.serialize_flat_with_task_data,
|
||||||
# substitution_variables = request.args.to_dict()
|
process_instances.items,
|
||||||
# result_dict = process_instance_report.generate_report(
|
)
|
||||||
# process_instances.items, substitution_variables
|
)
|
||||||
# )
|
|
||||||
|
|
||||||
# results = result_dict["results"]
|
|
||||||
# report_metadata = result_dict["report_metadata"]
|
|
||||||
|
|
||||||
results = process_instances.items
|
|
||||||
report_metadata = process_instance_report.report_metadata
|
report_metadata = process_instance_report.report_metadata
|
||||||
|
|
||||||
response_json = {
|
response_json = {
|
||||||
|
@ -315,3 +315,22 @@ class ProcessInstanceService:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return task
|
return task
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def serialize_flat_with_task_data(
|
||||||
|
process_instance: ProcessInstanceModel,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""serialize_flat_with_task_data."""
|
||||||
|
results = {}
|
||||||
|
try:
|
||||||
|
original_status = process_instance.status
|
||||||
|
processor = ProcessInstanceProcessor(process_instance)
|
||||||
|
process_instance.data = processor.get_current_data()
|
||||||
|
results = process_instance.serialized_flat
|
||||||
|
# this process seems to mutate the status of the process_instance which
|
||||||
|
# can result in different results than expected from process_instance_list,
|
||||||
|
# so set the status back to the expected value
|
||||||
|
results["status"] = original_status
|
||||||
|
except ApiError:
|
||||||
|
results = process_instance.serialized
|
||||||
|
return results
|
||||||
|
Loading…
x
Reference in New Issue
Block a user