I need to search all stories in a PROJECT, summing up a total of the story points, if any, found!

I need to search all stories in a PROJECT, summing up a total of the story points, if any, found!

I know how to sum up story points of stories in an epic, and I know how to sum up story points from linked issues - but i cant get my mind around a solution for summing up the story points for a project - and as it happens, this is exactly what i need to do. Someone please help - this i driving me crazy!

3 answers

Hello @Soeren Carl Bauer,

You could be using the following as a base project:

# Python

import requests, json

baseRestApiUrl = "http://localhost:8080/rest/api/2"
endpointFields = "/field"
endpointSearch = "/search"

jiraUsername = "admin"
jiraPassword = "mysecretpassword"

headers = {'Content-Type': 'application/json'}

def getCustomField(fieldName):
r = requests.get(
baseRestApiUrl + endpointFields,
auth=(jiraUsername, jiraPassword),
headers=(headers),
verify=False)

for field in r.json():
if field['name'] == fieldName:
return field['id']

def sumStoriesWithStoryPoints(projectKey):
r = requests.get(
baseRestApiUrl + endpointSearch + '?jql=project%3D' + projectKey,
auth=(jiraUsername, jiraPassword),
headers=(headers),
verify=False)

total = 0.0
for issue in r.json()['issues']:
total += issue['fields'][getCustomField('Story Points')]

print total

sumStoriesWithStoryPoints('PROJ')

Kind regards,

Rafael

Thanks Rafael

 

The approach you suggest is much more elegant (and fast) than the solution i have come up with (Groovy embedded JQL).

 

I am going to Work with your code moving forward.

 

Let me say that it is really great that you took the time to really help, not just throw a remark or a pointer.

 

I hope that i can "repay you" by also submitting some of my ideas if that can, one day, help someone else.

 

Thanks!

I am glad I could help you somehow.

Have a Happy New Year!!

Further info: i know how to sum up the story points of stories in a project using JQL - but i need to do it using scriptrunner/groovy in a scripted field....something like a "for each"-like traversing thingie....

0 vote

You would need to create a scripted field with a code which would go through all necessary links from the current issue and sum up all the story points. The script would depend on the links you use.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

136 views 5 9
Read article

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