spiff-arena/spiffworkflow-backend/bin/last_pi_milestone_query

33 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
mysql -uroot spiffworkflow_backend_local_development -e '
Feature/business end states (#333) * WIP: some updates to support new spiff w/ burnettk * unit tests are passing * all tests except message tests are passing * fixed usage of catch message event w/ burnettk * messages are working again w/ burnettk * uncommented remaining message tests w/ burnettk * fixed cypress tests w/ burnettk * use main for spiffworkflow * translated mysql last milestone query to sqlalchemy w/ burnettk * fixed last milestone query so instances still return if no milestone found and moved some code from the main report method to own methods * added some comments * added last milestone column to process instances table * display last milestone in instance list table w/ burnettk * remove 3 characters when truncating last milestone for ellipsis * make sure we have a current processor so we don't return null * remove sleep * The background processor now only picks up processes that were last updated more than a minute ago to avoid conflicting with the interstitial page. With the understanding that we can rmeove this limitation when we can refactor to allow the backend processes to provide updates on what they are doing. * pyl w/ burnettk * cache last milestone on instances * pyl * added test for last milestone and added it to the proces instance show page w/ burnettk * fixed broken test w/ burnettk * fixed last milestone header * removed duplicated column * fixed broken test --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com> Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com> Co-authored-by: danfunk <daniel.h.funk@gmail.com> Co-authored-by: burnettk <burnettk@users.noreply.github.com>
2023-09-07 14:10:44 +00:00
SELECT td.bpmn_identifier, p.id FROM process_instance p
JOIN process_instance_event pie ON pie.process_instance_id = p.id
JOIN task t ON t.guid = pie.task_guid
JOIN task_definition td ON td.id = t.task_definition_id
JOIN (
SELECT max(pie.id) as max_pie_id
FROM process_instance_event pie
JOIN task t ON t.guid = pie.task_guid
JOIN task_definition td ON td.id = t.task_definition_id
JOIN bpmn_process bp ON bp.id = t.bpmn_process_id
WHERE td.typename = "IntermediateThrowEvent" OR (bp.direct_parent_process_id is NULL AND td.typename IN ("SimpleBpmnTask", "BpmnStartTask"))
GROUP BY pie.process_instance_id
) AS max_pie ON max_pie.max_pie_id = pie.id
Feature/business end states (#333) * WIP: some updates to support new spiff w/ burnettk * unit tests are passing * all tests except message tests are passing * fixed usage of catch message event w/ burnettk * messages are working again w/ burnettk * uncommented remaining message tests w/ burnettk * fixed cypress tests w/ burnettk * use main for spiffworkflow * translated mysql last milestone query to sqlalchemy w/ burnettk * fixed last milestone query so instances still return if no milestone found and moved some code from the main report method to own methods * added some comments * added last milestone column to process instances table * display last milestone in instance list table w/ burnettk * remove 3 characters when truncating last milestone for ellipsis * make sure we have a current processor so we don't return null * remove sleep * The background processor now only picks up processes that were last updated more than a minute ago to avoid conflicting with the interstitial page. With the understanding that we can rmeove this limitation when we can refactor to allow the backend processes to provide updates on what they are doing. * pyl w/ burnettk * cache last milestone on instances * pyl * added test for last milestone and added it to the proces instance show page w/ burnettk * fixed broken test w/ burnettk * fixed last milestone header * removed duplicated column * fixed broken test --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com> Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com> Co-authored-by: danfunk <daniel.h.funk@gmail.com> Co-authored-by: burnettk <burnettk@users.noreply.github.com>
2023-09-07 14:10:44 +00:00
# WHERE pie.process_instance_id = 27
;
'