Give issues a value based on it's priority, sum them all up and divide against a fixed value

Anton Pettersson April 22, 2017

I am supposed to automate the calculation of something we refer to as "Bug Score". This value is used to determine how good we are at finding bugs before release. We want to see this value in a Dashboard.

Currently we calculate it this way:

Bug score = 100*(blocker) + 50*(critical) + 25*(major) +5*(medium) + 1*(minor + trivial) / (707 * 100)

For example: a bug report with priority "Blocker" will get a value of 100 and one with "Critical" 50 and so on. These are summed up and divided by 707 which is a fixed value we decided on at some point in time.

This only applies to bugs which have status "Open" or "Reopened" and are flagged as "Is customer reported?" (this is a custom field).

I was thinking I could create a custom field which can check it's own priority and then set the value accordingly and then have some Dashboard widget to the sum up all bugs flagged as customer reported and do the division. But I wouldn't know how to actually do this.

I feel there is some help in these earlier questions:

2 answers

1 accepted

1 vote
Answer accepted
David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2017

You can use the JIRA Misc Custom Fields add-on to achieve the same.

It's difficult to write a fully-working formula without knowing the exact details of your instance, but to give you a rough idea:

<!-- @@Formula:
var priority = issue.get("priority").getName();
var customerReported = issue.get("Customer Reported") != null && issue.get("Customer Reported").size() > 0;

if (!customerReported) return null;

if (priority.equals("Blocker") return 100;
if (priority.equals("Critical") return 50;
if (priority.equals("Major") return 25;
if (priority.equals("Medium") return 5;
return 1;
-->

And the filter of Open or Reopened issues will be done at the dashboard widget level.

Anton Pettersson June 27, 2017

Terribly sorry for the late reply but I have been over my head in other work

I get an error in catalina.out. It seems it does not like the returns when checking priority. Not sure why though:

2017-06-27 14:53:26,459 http-bio-8080-exec-268 ERROR <username> 893x2262270x2 1erjiom <ip1>,<ip2>,127.0.0.1 /secure/EditAction!default.jspa [innovalog.jmcf.fields.CalculatedNumberField] CalculatedNumberField: error evaluating formula of field "Bug score value" of issue <issue-id>: 
Parse error at line 8, column 32. Encountered: return
Navigate to the following URL to edit the formula: <url>/jira/secure/admin/EditCustomField!default.jspa?id=12870

 Thanks for all the help so far!

Anton Pettersson June 27, 2017

There was a missing parenthesis in those lines. Now it works! Can't believe I missed it. :)

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2017

You are right, you can implement this fairly trivial custom field using the ScriptRunner add-on.

See: https://scriptrunner.adaptavist.com/latest/jira/scripted-fields.html#_calculate_a_number_based_on_other_fields

Then you can sum up scores with the 2D Filter Results gadget.

Anton Pettersson June 27, 2017

Terribly sorry for the late reply but I have been over my head in other work. Thanks for the reply. I am currently trying out JIRA Misc Custom Fields.

Much appreciated!

Suggest an answer

Log in or Sign up to answer