Last active
July 6, 2020 14:35
Star
You must be signed in to star a gist
Python script to calculate the number of Story Points closed for a given JIRA filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jira import JIRA | |
import getpass | |
# add your JIRA instance URL here | |
jiraURL = 'https://myjira.com' | |
# update with JIRA username or replace it with | |
# username = input('Type your JIRA username') | |
# to ask for the username in the command line | |
username = 'myusername' | |
try: | |
password = getpass.getpass(prompt='Type your JIRA password: ') | |
except Exception as error: | |
print('Error when getting password', error) | |
else: | |
jira = JIRA(jiraURL, basic_auth=(username, password)) | |
try: | |
filterId = '27629' | |
filterJQL = jira.filter(filterId).jql | |
except Exception as error: | |
print('JIRA filter ' + filterId + 'is not available or does not exist') | |
else: | |
issues = jira.search_issues(filterJQL) | |
totalPoints = closedPoints = 0 | |
for i in range(len(issues)): | |
fields = issues[i].fields | |
points = 0 if fields.customfield_10002 == None else fields.customfield_10002 | |
totalPoints += points | |
closedPoints += 0 if fields.status.name != 'Closed' else points | |
percentage = 0 if (totalPoints == 0) else (closedPoints / totalPoints) * 100 | |
print('Total points: ', totalPoints) | |
print('Closed points: ', closedPoints) | |
print('Closed %: ', round(percentage, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment