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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

850 views 2 9
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