How to create a report that tells measures th amount of "time" between comments (reporter/assignee?)

Hi,

I have a use case - where we are wanting to see the amount of time between an assignee’s comment, and the reporter’s response for each issue within a project.

Could anyone provide the way to create such a report? We don’t have the current javascript, properties or measures needed to create this.

Hi @Greg_Chapman,

Your request is complex. For a sophisticated solution, you would have to consider the comment order, assignee or reporter comments multiple times in between or other users’ comments, and one of the parties you are interested in respond. Also, assignee or reporter changes can alter the expected results.

For a simple solution - considering the current issue assignee and reporter, and the duration between the assignees first comment and reporter first comment, you can add the parameters below to the eazyBI advanced settings:

[jira.customfield_waittime]
name = "Wait time"
data_type = "decimal"
measure = true
javascript_code = '''
if(issue.fields.comment.comments.length > 0 && issue.fields.assignee && issue.fields.reporter) {
  var allComments = issue.fields.comment.comments;
  var duration;
  // iterate through all comments
  for (i = 0; i < allComments.length; i++) {
    // get assignee comment timestamp
    if(allComments[i].author.key == issue.fields.assignee.key) {
      var assignComm = Date.parse(allComments[i].created.toString().substr(0,23));
    }
    // get reporter comment timestamp
    if(allComments[i].author.key == issue.fields.reporter.key) {
      var reportComm = Date.parse(allComments[i].created.toString().substr(0,23));
    }
    if(assignComm < reportComm) {
      if(!duration) {
        duration = reportComm - assignComm;
      }
    }
  }
  issue.fields.customfield_waittime = duration / 1000 / 60;
}
'''

The parameters above will create a new custom field returning the duration in minutes that you can import as a measure. Once imported, you can create a new calculated measure referencing the measure in the formula and use the “Duration” formatting. See an example below:

See more details on JavaScript calculated custom fields on the eazyBI documentation page - JavaScript calculated custom fields - eazyBI for Jira.

Best,
Roberts // support@eazybi.com

1 Like

Excellent, thank you very much!