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!
Hello @bauerprocessconsulting,
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad I could help you somehow.
Have a Happy New Year!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.