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

This widget could not be displayed.

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!!

This widget could not be displayed.

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....

This widget could not be displayed.

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
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 yesterday 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...

79 views 1 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