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

Hi.

This is exactly what i was looking for. but it seems to be broken in the current version.
Is it possible to fix it in the lastest version?

multiple_dementions is raised error.

Hi,

We are not aware of the reasons why such configuration would not be working in some version. Please, try to do the double data import: first time with the two custom fields deselected, then select them again for import.

Please, send the support request if the problem persists.

Kindly,

Janis, eazyBI support

Here is where i entered the code you guided me to.

Source Data > Jira Import > Jira Import Options > Custom Fields > Add New Custom Fields > Add additional advanced settings

I have seperated the javascript code from the quoted code so that only the javasript code is seperated when inserted.
And Javascript is treated as a return value, so i made sure to return the result variable.

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");
  }
}

return result;

In this case, unlike the instructions, only one import destination appears, and an error occurs when i try to import the jira source data again after saving.

Other settings are also an important part of this solution, so please contact the support with further details.

Kindly,
Janis, eazyBI support