Project

General

Profile

Calculate SLA work time

Added by Antonio Malfi 8 months ago

Hello, despite having the SLA plugin, I need to calculate working time only in specific states, namely when the ticket is in progress or when the ticket is assigned to certain user IDs.
Does this functionality exist?

The problem should be solvable through a query or by considering the states:

States in which to calculate the working time from value = 1 to old_value = 4:
old_value 1 to value 2: the start time to be used is the created_on field of the issues table, i.e., the creation date of the ticket.
old_value 2 to value 3: the start time is the created_on field of the journals table of the previous row when old_value is 1, while the finish time is created_on from journals.
old_value 3 to value 4: the start time is the created_on field of the journals table of the previous row when old_value is 2, while the finish time is created_on from journals.

SELECT
j.id,journalized_id,j.user_id,j.created_on/*data cambio stato*/,'end tabella journals' as asd,
d.id,d.journal_id,d.old_value,d.value,'end tabella journal_details' as asd1,
i.id,i.created_on as DataCreazioneTK
FROM `redmine-test`.journals j
inner join `redmine-test`.journal_details d on d.journal_id=j.id
inner join `redmine-test`.issues i on i.id=j.journalized_id
where journalized_id=5762 /*tk id*/ and prop_key='status_id'

/* stati id
1 Aperto
2 Preso in carico
3 In lavorazione
4 Sospeso
5 Richiesta informazioni
6 Completato
*/