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

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
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

524 views 3 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you