Hello,
I have a need to get the total time an issue was flagged via the Flagged field in Working Days.
There is this article regarding Calculating Blocked time on Issues using Flagged Field that uses JavaScript through Advance Settings, but it gives a value is total days (including weekends and holidays).
Here is the JavaScript from the article:
[jira.customfield_days_flagged]
name = "Days Flagged Impediment"
data_type="decimal"
measure = true
javascript_code='''
var date_from = Date.parse(issue.fields.created);
var days_flagged = 0.0;
issue.changelog.histories.forEach(function(history){
history.items.forEach(function(historyItem){
if (historyItem.field == "Flagged") {
to = historyItem.toString;
from = historyItem.fromString;
if(to.equals("Impediment")) {
date_from = Date.parse(history.created);
}
if (from && from.equals("Impediment")) {
date_to = Date.parse(history.created);
days_flagged += (date_to - date_from) / 1000/ 60 /60 / 24 ;
}
}
});
});
if (days_flagged>0) issue.fields.customfield_days_flagged=days_flagged;
'''
How would I alter the query to give the value in Working Days?
Thank You in advance,
Larry R.