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

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

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.

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!

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

0 votes

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.

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,798 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot