updated milestone table query to include logic similar to caching last_milestone on the pi w/ burnettk (#505)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2023-09-20 13:25:42 -04:00 committed by GitHub
parent 025a62aa37
commit ff9d34fe83
3 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,5 @@
from operator import or_
import flask.wrappers
from flask import jsonify
from flask import make_response
@ -38,10 +40,22 @@ def log_list(
)
)
if not events:
# NOTE: we could also consider a "is_milestone" column on the process_instance_event table,
# populating this value in task_service, and move setting the last_milestone on process instances
# to the same location in task_service
log_query = log_query.filter(
and_(
TaskModel.state.in_(["COMPLETED"]), # type: ignore
TaskDefinitionModel.typename.in_(["IntermediateThrowEvent"]), # type: ignore
or_(
TaskDefinitionModel.typename.in_(["IntermediateThrowEvent"]), # type: ignore
and_(
TaskDefinitionModel.typename.in_(["StartEvent", "EndEvent"]), # type: ignore
or_(
TaskDefinitionModel.bpmn_name.is_not(None), # type: ignore
BpmnProcessDefinitionModel.full_process_model_hash.is_not(None), # type: ignore
),
),
),
)
)

View File

@ -116,8 +116,8 @@ class TestLoggingService(BaseTest):
assert log_response.status_code == 200
assert log_response.json
logs: list = log_response.json["results"]
assert len(logs) == 2
assert len(logs) == 4
for log in logs:
assert log["process_instance_id"] == process_instance.id
assert log["bpmn_task_type"] == "IntermediateThrowEvent"
assert log["bpmn_task_type"] in ["StartEvent", "EndEvent", "IntermediateThrowEvent"]

View File

@ -259,7 +259,15 @@ export default function ProcessInstanceLogList({
const getTableRow = (logEntry: ProcessInstanceLogEntry) => {
const tableRow = [];
const taskNameCell = <td>{logEntry.task_definition_name}</td>;
let taskName = logEntry.task_definition_name;
if (!taskName && !isEventsView) {
if (logEntry.bpmn_task_type === 'StartEvent') {
taskName = 'Started';
} else if (logEntry.bpmn_task_type === 'EndEvent') {
taskName = 'Completed';
}
}
const taskNameCell = <td>{taskName}</td>;
const bpmnProcessCell = (
<td>
{logEntry.bpmn_process_definition_name ||