Several minor enhancements
This commit is contained in:
@@ -7,6 +7,25 @@ import re
|
||||
import csv
|
||||
import xlsxwriter
|
||||
import logging
|
||||
from bisect import bisect_left
|
||||
|
||||
def take_closest(myList, myNumber):
|
||||
"""
|
||||
Assumes myList is sorted. Returns closest value to myNumber.
|
||||
|
||||
If two numbers are equally close, return the smallest number.
|
||||
"""
|
||||
pos = bisect_left(myList, myNumber)
|
||||
if pos == 0:
|
||||
return myList[0]
|
||||
if pos == len(myList):
|
||||
return myList[-1]
|
||||
before = myList[pos - 1]
|
||||
after = myList[pos]
|
||||
if after - myNumber < myNumber - before:
|
||||
return after
|
||||
else:
|
||||
return before
|
||||
|
||||
def get_assignee(type, issue):
|
||||
isBuergerfrontend = False
|
||||
@@ -19,7 +38,7 @@ def get_assignee(type, issue):
|
||||
return 'reu9001'
|
||||
return 'thh9001'
|
||||
elif type.startswith('Test-Anpassung'):
|
||||
return 'ada9001'
|
||||
return 'osm9005'
|
||||
|
||||
def create_subtask(issue, parent, type, subtask_sp, estimation_remark):
|
||||
escaped = issue.fields.summary.replace('"', r'\"')
|
||||
@@ -71,15 +90,15 @@ logging.basicConfig(filename='sub_task_generator.log',
|
||||
|
||||
host = "https://jira.wien.gv.at/"
|
||||
pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"
|
||||
sprint = 4
|
||||
sprint = 9
|
||||
|
||||
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=22140') #, expand='changelog')
|
||||
#issues_Jql = jira_server.search_issues('key in (DKARB-34)') #, expand='changelog')
|
||||
issues_Jql = jira_server.search_issues('filter=24707') #, 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('Creating sub-tasks out of estimation of pre-planning sprint {}'.format(sprint))
|
||||
@@ -121,8 +140,12 @@ for issue in issues_Jql:
|
||||
subtask_ph = float(comment_line_sub_parts[0]) * 0.5
|
||||
estimation_remark = comment_line_sub_parts[1]
|
||||
else:
|
||||
subtask_ph = float(comment_line_parts[1]) * 0.5
|
||||
estimation_remark = ""
|
||||
if comment_line_sub_parts[0].strip().isnumeric():
|
||||
subtask_ph = float(comment_line_sub_parts[0]) * 0.5
|
||||
estimation_remark = ""
|
||||
else:
|
||||
if comment_line_sub_parts[0].strip() == "tbd":
|
||||
subtask_ph = take_closest([1,2,3,5,8,13,21,42], sp_sum/3)
|
||||
|
||||
if comment_line_parts[0][:15] != "Test-Ausführung":
|
||||
create_subtask(issue,
|
||||
|
||||
Reference in New Issue
Block a user