73 lines
2.9 KiB
Python
73 lines
2.9 KiB
Python
# find comments with estimations out of pre-planning
|
|
# zisco 2021-09-30 19:50
|
|
|
|
from types import ClassMethodDescriptorType
|
|
from jira import JIRA, Issue, Comment, exceptions
|
|
from datetime import date
|
|
import re
|
|
import csv
|
|
import xlsxwriter
|
|
import logging
|
|
|
|
logging.basicConfig(filename='sprint efforts.log',
|
|
filemode='a',
|
|
format='%(asctime)s - %(levelname)s: %(message)s',
|
|
level=logging.INFO,
|
|
encoding='utf-8')
|
|
|
|
host = "https://jira.wien.gv.at/"
|
|
pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"
|
|
#sprint = 2
|
|
|
|
row = 0; col = 0
|
|
workbook = xlsxwriter.Workbook(f'efforts as of preplanning {date.today()}.xlsx')
|
|
worksheet = workbook.add_worksheet('efforts')
|
|
|
|
cell_format = workbook.add_format()
|
|
cell_format.set_bold()
|
|
|
|
worksheet.write(row, col, 'Story' , cell_format)
|
|
worksheet.write(row, col + 1, 'Sub-Task' , cell_format)
|
|
worksheet.write(row, col + 2, 'Summary' , cell_format)
|
|
worksheet.write(row, col + 3, 'Labels' , cell_format)
|
|
worksheet.write(row, col + 4, 'timeoriginalestimate', cell_format)
|
|
worksheet.write(row, col + 5, 'SP' , cell_format)
|
|
worksheet.write(row, col + 6, 'PT' , cell_format)
|
|
row += 1
|
|
|
|
headers = JIRA.DEFAULT_OPTIONS["headers"].copy()
|
|
headers["Authorization"] = f"Bearer {pat}"
|
|
jira_server = JIRA(server=host, options={"headers": headers})
|
|
|
|
# use filter or single issue
|
|
issues_Jql = jira_server.search_issues('filter=28412') #, expand='changelog')
|
|
#issues_Jql = jira_server.search_issues('key in (wrgwr-2838, wrgwr-2839)', expand='changelog')
|
|
#issues_Jql = jira_server.search_issues('key in (DKARB-140)') #, expand='changelog')
|
|
#issues_Jql = jira_server.search_issues('labels in (Refinement11012022) AND type not in (Bug) AND status not in (Done) and ("Story Points" is EMPTY or "Story Points" = 0)') #, expand='changelog')
|
|
|
|
logging.info(f'Sum effort stored in issue-comments of pre-planning of {date.today()}')
|
|
xsp = lambda s: s or 0
|
|
|
|
issue: Issue
|
|
for issue in issues_Jql:
|
|
single_issue = jira_server.issue(issue.key)
|
|
logging.info(f'OriginalTimeEstimate: {single_issue.fields.timeoriginalestimate}')
|
|
|
|
for subtask in issue.fields.subtasks:
|
|
ssubtask = jira_server.issue(subtask.key) # this is essential to access 'timeoriginalestimate'
|
|
|
|
worksheet.write(row, col, issue.key)
|
|
worksheet.write(row, col + 1, ssubtask.key)
|
|
worksheet.write(row, col + 2, ssubtask.fields.summary)
|
|
alllabels = []
|
|
labels = ssubtask.fields.labels
|
|
for i in labels:
|
|
alllabels.append(i)
|
|
worksheet.write(row, col + 3, ','.join(alllabels, ))
|
|
worksheet.write(row, col + 4, ssubtask.fields.timeoriginalestimate)
|
|
worksheet.write(row, col + 5, f'=E{row + 1}/28800')
|
|
worksheet.write(row, col + 6, f'=F{row + 1}/0.5')
|
|
row += 1
|
|
|
|
worksheet.autofit()
|
|
workbook.close() |