Calculate the WorkRatio for the sum of all Subtasks

Hi,

we have a Project with Tasks and Subtasks. The time logging is only done in the Subtasks. The WorkRatio is automatically calculated by JIRA for the Subtasks.

But it is not working for the Tasks (with the sums: E-original Estimate).
So i used the addon "JIRA Misc Custom Fields" with a "Calculated Number Field".

My sum calculation works, but I found that it creates a lot of Errors in the logfile.

Calculation:

<!-- @@Formula: (issue.get("aggregatetimespent") != null ? issue.get("aggregatetimespent") : 0) *100 / (issue.get("aggregatetimeoriginalestimate") != null ? issue.get("aggregatetimeoriginalestimate") : 0) -->

I used the "(issue.get("customfield_10114") != null ? issue.get("customfield_10114") : 0)" from https://innovalog.atlassian.net/wiki/spaces/JMCF/overview#JIRAMiscCustomFields-calculatednumberfield
I am not sure, but I think it sorts out empty or 0 values.

 

Error in logfiles:
Target exception: java.lang.ArithmeticException    
Navigate to the following URL to edit the formula: http://...:8080/secure/admin/EditCustomField!default.jspa?id=11107
2017-10-11 09:28:48,628 http-nio-8080-exec-13 ERROR zeppbot 568x194632x1 mufley 10.154.3.62 /rest/cb-automation/latest/project/GLOBAL/rule/29/execute [c.i.jmcf.fields.CalculatedNumberField] CalculatedNumberField: error evaluating formula of field "KPI" of issue TEST-309:
    Sourced file: inline evaluation of: `` (issue.get("aggregatetimespent") != null ? issue.get("aggregatetimespent") : 0) . . . '' : Arithemetic Exception in binary op : at Line: 1 : in file: inline evaluation of: `` (issue.get("aggregatetimespent") != null ? issue.get("aggregatetimespent") : 0) . . . '' : ;

 

Is there soms built-in JIRA field for this one that I can use instead of the calculated field?
What is wrong in my Formula?

1 answer

This widget could not be displayed.

Could you explain "The WorkRatio is automatically calculated by JIRA for the Subtasks.  But it is not working for the Tasks" more?

 

I mean the red marked JIRA Field "WorkRatio".
But workratio is only filled for the Subtasks.

Thats why i tried to calculate it manually as KPI, see the green marking.

workratio.png

There is no work ratio for the top-level issue, you already said you don't put estimates on it.

I'm not sure how you'd get the data that sums up the ratios for the sub-tasks on an issue in JMCF

The sum up data are the jira fields:
aggregatetimespent
aggregatetimeoriginalestimate
They are calculated by jira.

The jira workratio is calculated with timespent and originalesimate, not with the "aggreagte" ones.


I edited my script a bit because  it only set null to 0. I forgot that I also had some 0 as values, which I must exclude because Division by 0 is not allowed.
I think that these were my Errors in the logfile.

It works for me now.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

229 views 3 0
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