Count issues that were altered between Resolved and Closed Status

Hi there,

as the subject states I’m looking for a solution to count issues per month that match this certain criteria.
As those were tickets that our Service Desk team had to adjust on their Quality Gate.
So I need a calculated figure that counts the issues that were updated after being in Status resolved.
I am absolutely no scripting guy and all the field that I added with Javascript are more or less 1:1 copies from this community.

Help is greatly appreciated!

Kind regards
Richard

Any Ideas anyone? I feel like it will need a calculated number that checks the resolution date and the “updated” date and compares them, but the move to “closed” will change the “updated” value, too? right?

Hi,

This use case cannot be covered by the standard elements of the eazyBI data cube. The way to go is to implement a Javascript-calculated custom field similar to this: Count User interaction with Issue. This Javascript records the count of user activities on issues and shows the count on the Time dimension.

Your use case would require adjustmetn to check that user activity happened between the resolution date and the date when the last closed status was reached. Perhaps, a simpler solution will be to check if there is a user activity after the resolution date.

However, the possible outcome will differ between data centers and the Cloud. In the case of the Cloud, eazyBI has almost full access to the changelog records during the data import. In the case of the data center, we can rely only on the status change history when writing Javascript code in the calculated field (which will not help in this use case). A Scriptrunner field on the Jira side could be a solution for the data center.

Kindly,
Janis, eazyBI support

1 Like

Fortunately I get my data from Jira Cloud, so log access is not the problem.
I’m just not that familiar to scripting. So how would I change the conditions in the example by Zane to match my wanted condition that it only counts the Chagnes after it reached the status “Resolved”?

I am still struggling with this.
I imported the code in the other example and understood what it does, but I can’t figure out to transform into something solving my use case. Any help?

I can’t burn the complexity as there naturally will be a user interaction after resolved, as our Service Desk will check the tickets and put them to status closed.
It would be more like to check if there is a change of at least one of two fields (components and Solution) after it reaches status “Resolved”.

Any ideas @zane.baranovska ?

Hi,

The following JS is for a New calculated field counting the activities after the resolution date:

var activities = [];
var resolutionDate = Date.parse(issue.fields.resolutiondate);

// Check if the issue has a resolution date
if (resolutionDate) {
  // Check history records for each issue
  if (issue.changelog.histories && issue.changelog.histories.length > 0) {
    for (i = 0; i < issue.changelog.histories.length; i++) {
      if (
        issue.changelog.histories[i].author &&
        issue.changelog.histories[i].author.accountId
      ) {
        // Get date and author of each history record
        var activityDate = Date.parse(issue.changelog.histories[i].created);
        var activityAuthor = issue.changelog.histories[i].author.accountId;

        // Check if the activity date is after the resolution date
        if ((activityDate - resolutionDate) > 1000) {
          activities.push(
            activityAuthor +
              ',' +
              new Date(activityDate).toISOString().substr(0, 10) + // Convert to ISO date string
              ',1'
          );
        }
      }
    }
  }

  // Check comments for each issue
  if (issue.fields.comment.comments && issue.fields.comment.comments.length > 0) {
    for (j = 0; j < issue.fields.comment.comments.length; j++) {
      if (
        issue.fields.comment.comments[j].author &&
        issue.fields.comment.comments[j].author.accountId
      ) {
        // Get date and author of each comment
        var activityDate = Date.parse(issue.fields.comment.comments[j].created);
        var activityAuthor = issue.fields.comment.comments[j].author.accountId;

        // Check if the activity date is after the resolution date
        if ((activityDate - resolutionDate) > 1000) {
          activities.push(
            activityAuthor +
              ',' +
              new Date(activityDate).toISOString().substr(0, 10) + // Convert to ISO date string
              ',1'
          );
        }
      }
    }
  }
}

// Return the array of changelogs and comments after the resolution date
return activities.join('\n');

The field configuration could look like this:

Kindly,
Janis, eazyBI support

1 Like

Thanks, Janis.
I will try this immediately!

It gives me an error that the results won’t fit into an integer:

It gives me an error that the results won’t fit into an integer:

Hi,

a likely workaround for this error is to do the “double import”. First, please, run the import with the custom field unchecked from the data import options (that will drop the database structures behind this custom field). Then run import with the field checked again. That should be done every time when you change advanced settings for the custom field.

Please contact support once you got stuck with this solution.

Kindly,
Janis, eazyBI support