Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate percent?

jun lee
Contributor
February 23, 2023

I want to make an automation rule or script of scriptrunner. Ultimately, I want to calculate the progress percent and display from the Gantt chart.

condition 1 : linked issue type id = 10511, 10612, 10603

condition 2 : linked id = 10309, 10703

condition 3 : linked issue status = completion

calculation and update custom field : (number of condition1 & condition2 & condition3) / (total number of condition1) x 100

How can I do that?

 

I think this is the similar solution : https://community.atlassian.com/t5/Jira-questions/Calculate-sum-of-Story-Points-in-all-linked-issues-except-the/qaq-p/2205697

1 answer

0 votes
Nic Brough -Adaptavist-
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.
February 24, 2023

That's not going to work, your calculation is not going to give you progress, it's going to give you the mean average of the estimates.

The code given by Ram in the question you've linked to is a good starting point, but you will want to modify it to so that it has some more if branches.

I suspect what you really want to do is:

  • For each link on an issue, look at the issue at the other end of the link
    • If the ID of the issue is 10309 or 10703 or the issue type is 10511, 10612 or 10603 then
      • Look at the status of the issue
      • If it is "completion" add the story points to a variable in the script called something like completed-points
      • Whatever the status, add the story points to total-points
  • Return the value of (100 * completed-points) / total-points, for a "progress" percentage.

Suggest an answer

Log in or Sign up to answer