Dev in progress
This commit is contained in:
+27
-14
@@ -1,6 +1,7 @@
|
||||
# find comments with estimations out of pre-planning
|
||||
# zisco 2021-09-30 19:50
|
||||
|
||||
from multiprocessing.sharedctypes import Value
|
||||
from types import ClassMethodDescriptorType
|
||||
from jira import JIRA, Issue, Comment, exceptions
|
||||
import re
|
||||
@@ -49,6 +50,14 @@ def create_subtask(issue, parent, type, subtask_sp, estimation_remark):
|
||||
if subtask:
|
||||
raise exceptions.JIRAError
|
||||
except exceptions.JIRAError:
|
||||
# correct estimation
|
||||
#subtask.fields('timetracking': {'originalEstimate'}).Value() = subtask_sp
|
||||
single_issue = jira_server.issue(subtask[0].key)
|
||||
try:
|
||||
single_issue.update(fields={'timetracking': {'originalEstimate': '{}d'.format(subtask_sp)}})
|
||||
except Exception as e:
|
||||
logging.info(e)
|
||||
|
||||
logging.info(f'Skip creating Sub-Task {type} for {issue} as it already exists')
|
||||
return
|
||||
|
||||
@@ -90,15 +99,15 @@ logging.basicConfig(filename='sub_task_generator.log',
|
||||
|
||||
host = "https://jira.wien.gv.at/"
|
||||
pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"
|
||||
sprint = 9
|
||||
sprint = 4
|
||||
|
||||
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=24707') #, expand='changelog')
|
||||
#issues_Jql = jira_server.search_issues('key in (DKARB-140)') #, expand='changelog')
|
||||
issues_Jql = jira_server.search_issues('filter=25827') #, expand='changelog')
|
||||
#issues_Jql = jira_server.search_issues('key in (WRWGR-2885)') #, 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))
|
||||
@@ -124,7 +133,7 @@ for issue in issues_Jql:
|
||||
for comment in comments:
|
||||
comment_lines = comment.body.splitlines()
|
||||
|
||||
if len(comment_lines) == 5:
|
||||
if len(comment_lines) == 7:
|
||||
if comment_lines[0][:5] == "Dev B":
|
||||
for comment_line in comment_lines:
|
||||
if comment_line != "":
|
||||
@@ -133,19 +142,23 @@ for issue in issues_Jql:
|
||||
|
||||
# if 1. Test* != NN create a sub-task (if not existing)
|
||||
if len(comment_line_parts) == 2:
|
||||
if comment_line_parts[1] != u'\xa0': # empty string
|
||||
if (comment_line_parts[1][-2:] != 'NN') and (comment_line_parts[1][-1:] != '-'): # NN means NotNecessary
|
||||
comment_line_sub_parts = comment_line_parts[1].split(' (')
|
||||
if len(comment_line_sub_parts)>1:
|
||||
subtask_ph = float(comment_line_sub_parts[0]) * 0.5
|
||||
estimation_remark = comment_line_sub_parts[1]
|
||||
if comment_line_parts[1] != u'\xa0': # empty string
|
||||
if (comment_line_parts[1][-2:] != 'NN'): # NN means NotNecessary
|
||||
if (comment_line_parts[1][-1:] == '-'):
|
||||
subtask_ph = 0
|
||||
estimation_remark = "(not estimated yet)"
|
||||
else:
|
||||
if comment_line_sub_parts[0].strip().isnumeric():
|
||||
comment_line_sub_parts = comment_line_parts[1].split(' (')
|
||||
if len(comment_line_sub_parts)>1:
|
||||
subtask_ph = float(comment_line_sub_parts[0]) * 0.5
|
||||
estimation_remark = ""
|
||||
estimation_remark = comment_line_sub_parts[1]
|
||||
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_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