Hi!
I was trying to display info about how many hours each user spent being a assignee in a issue using this script:
[jira.customfield_days_for_assignee]
name = "Days for Assignee"
data_type = "decimal"
measure = true
multiple_dimensions = ["Time","Assignee"]
javascript_code = '''
var assigneehistory = new Array();
var datefrom = issue.fields.created;
var assignee = null;
resolution = false;
issue.changelog.histories.forEach(function(history){
history.items.forEach(function(historyItem){
if (historyItem.field == "assignee") {
assignee = historyItem.from;
if (! resolution) {
dateto = history.created;
if(assignee){
duration = (Date.parse(dateto) - Date.parse(datefrom)) / 1000 / 3600;
assigneehistory.push(dateto.toString().substr(0,10) + "," + assignee + "," + duration + " horas");
}
datefrom = dateto;
assignee = historyItem.to;
}
}
if (historyItem.field == "resolution") {
if (historyItem.to) resolution = true;
else resolution = false;
}
});
});
if (issue.fields.resolutiondate && (issue.fields.assignee || assignee)) {
if (!assignee) assignee = issue.fields.assignee.name;
duration = (Date.parse(issue.fields.resolutiondate) - Date.parse(datefrom)) / 1000 / 3600;
assigneehistory.push(issue.fields.resolutiondate.toString().substr(0,10) + "," + assignee + "," + duration + " horas");
}
issue.fields.customfield_days_for_assignee = assigneehistory.join("\n");
It only returns in days, never in hours. How can I bring this info to my report?