- for running user tasks that are not claimed yet: the idleTime should be from the startDate to the current time, workTime is null
- for running user tasks that are claimed but not completed yet: in that case the idleTime is set fixed in the import, the workTime should be from the claim time to the current time
- for completed user tasks: idleTime and workTime are set and imported with the CompletedUserTaskImporter
- running flow nodes: duration = from start date to current time
- for completed flow nodes: durationInMs
To implement this in the elasticsearch request we use scripted fields where we can define what values are considered for calculating the metrics, e.g.:
to take idleTime for claimed usertasks if the value exists, and if not, to take the calculated value of current time of the request minus the start time.
Similarly with the workTime and the end date.
Together with Felix we agreed to approach it in this way and to consider also doing it for running process durations in the future.