-
Type:
Suggestion
-
Resolution: Unresolved
-
None
Issue Summary
- While querying the breached column in the jsm_sla table, some work items might have both "true" and "false" results.
Steps to Reproduce
- The following query should show if you have work items with both "true" and "false" for the "breached" column where the "sla_name" column = "Time to first response":
SELECT `Work item1`.`issue_key` AS `Work item key`,
`SLA`.`breached` AS `Breached`
FROM `jira_issue` AS `Work item1`
INNER JOIN `jsm_issue` AS `Work item2` ON `Work item2`.`issue_id` = `Work item1`.`issue_id`
INNER JOIN `jsm_sla` AS `SLA` ON `SLA`.`issue_id` = `Work item2`.`issue_id`
WHERE `SLA`.`sla_name` = 'Time to first response'
AND `Work item1`.`issue_key` IN (
SELECT `Work item1`.`issue_key`
FROM `jira_issue` AS `Work item1`
INNER JOIN `jsm_issue` AS `Work item2` ON `Work item2`.`issue_id` = `Work item1`.`issue_id`
INNER JOIN `jsm_sla` AS `SLA` ON `SLA`.`issue_id` = `Work item2`.`issue_id`
WHERE `SLA`.`sla_name` = 'Time to first response'
GROUP BY `Work item1`.`issue_key`
HAVING COUNT(DISTINCT `SLA`.`breached`) = 2
)
ORDER BY `Work item1`.`issue_key` ASC, `SLA`.`breached` ASC
LIMIT 1000;
Expected Results
We should only have one record for "true" or "false" by "sla_name".
Actual Results
Currently, we can have both:
| Work item key | Breached | SLA name |
| TEST-11814 | true | Time to first response |
| TEST-11814 | false | Time to first response |
Workaround
These issues seem to appear only for uncompleted SLA cycles, so we can add a filter step to only include "Completed" cycles. We should also only get records where the column "started_at" is not null:
Where (cycle_type = 'Completed' and started_at is not null)