Comments per hourly interval

Hello,

I would like to create a report which shows for one project in which hourly time intervals how many comments are added to a ticket.
For example that from four to five o’clock a total of 50 comments have been added (counting the comments of all tickets in the project).
I found it for the ticket creation date (Hourly time hierachy) but am not quite sure how to apply it to the number of comments.
Could you please help me with that?

Thank you
Johannes

Hi Johannes,

The solution is possible using a not-fully documented feature of how Javascript calculated custom fields could be used. The idea is that we can define a “dummy” dimension of the hours and then create a custom measure of comment count measures with the mapping to the hour’s dimension.

The following advanced settings should do that:

[jira.customfield_cmt_hrs_dim]
name="Comment Hours"
data_type="string"
dimension=true
separate_table=true

[jira.customfield_cmt_hrs]
name="Comment count by hours"
data_type="integer"
measure=true
multiple_dimensions=["Time","Comment Hours"]
javascript_code='''
var result=[];
if (issue.fields.comment && issue.fields.comment.comments) {
  for (cmt of issue.fields.comment.comments) {
    var hrs=new Date(Date.parse(cmt.created)).getHours();
    result.push(cmt.created.substr(0,10)+","+
    (hrs<10?("0"+hrs):hrs)+","+"1");
  }
}
if (result)            
  issue.fields.customfield_cmt_hrs=result.join("\n");
'''

Once you save the settings, you should see two additional custom fields available for import:

Importing the dimension and measure allows creating a report like this:

1 Like

Hi Janis,

works like a charm!

Thanks a lot for the help.
Johannes

1 Like