How to calculate issue resolution time per assignee (not using hours spent)

salvijus October 24, 2017

Hi,

I would like to calculate issue resolution time per each assignee involved and display it report where rows have assignees and columns have months.  

I created a custom field "Time per assignee" and added Javascript code to calculate measure values :

[jira.customfield_time_per_assignee]
name = "Time per assignee"
data_type = "decimal"
measure = true
multiple_dimensions = ["Time","Assignee"]
javascript_code = '''
var divider = 1000 * 60 * 60;
var assigneehistory = new Array();
var datefrom = issue.fields.created;
var assignee = "unassigned";
var assigneeItem = null;
var resolutionItem = null;
var resolution = null;
var resolutionDate = null;

issue.changelog.histories.forEach(function(history)
{
dateto = history.created;
history.items.forEach(function(historyItem)
{
if (historyItem.field == "assignee") {
assigneeItem = historyItem;
}
else if (historyItem.field == "resolution") {
resolutionItem = historyItem;
}
});
if (assigneeItem)
{
if ((!resolutionItem || resolutionItem.to) && !resolution)
{
assignee = assigneeItem.from ? assigneeItem.from : "unassigned";
duration = (Date.parse(dateto) - Date.parse(datefrom)) / divider;
assigneehistory.push(assignee + "," + duration);
}
datefrom = dateto;
assignee = assigneeItem.to ? assigneeItem.to : "unassigned";
}
if (resolutionItem)
{
if (!assigneeItem)
{
if (resolutionItem.to && !resolution)
{
duration = (Date.parse(dateto) - Date.parse(datefrom)) / divider;
assigneehistory.push(assignee + "," + duration);
}
datefrom = dateto;
}
resolution = resolutionItem ? resolutionItem.to : null;
resolutionDate = dateto;
}
resolutionItem = null;
assigneeItem = null;
});
for(i = 0; i < assigneehistory.length; i++) {
assigneehistory[i] = resolutionDate.toString().substr(0,10) + "," + assigneehistory[i];
}
issue.fields.customfield_time_per_assignee = assigneehistory.join("\n");
'''

This woks when issue has assignee, but unfortunately, my issues doesn't... Adding custom field something like "Resolved by" and using it instead of  Assignee (multiple_dimensions = ["Time","Resolved by"]) doesn't help, because the cube import throws an error telling that "Resolved by" cannot be used in multiple dimensions...

How could i solve this ? Is there an esier way to calculate how much time some  user was the assignee of an issue?

 

Thanks

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events