Dev in progress
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
# make page-header of confluence-area unique (add WGWR2)
|
||||
# zisco 2023-11-10 06:59
|
||||
|
||||
from distutils.log import INFO
|
||||
from atlassian import Confluence
|
||||
import logging
|
||||
import requests
|
||||
|
||||
logging.basicConfig(filename='confluence bulk.log',
|
||||
filemode='a',
|
||||
format='%(asctime)s - %(levelname)s: %(message)s',
|
||||
level=logging.WARNING,
|
||||
encoding='utf-8')
|
||||
logger = logging.getLogger('myLogger')
|
||||
logger.setLevel(level=logging.INFO)
|
||||
|
||||
confluence_host = "https://confluence.wien.gv.at/"
|
||||
confluence_pat = "MDI3ODU2NzkzMTAyOsPz47kjJvVdJa1bLpen3W5sB6S5"
|
||||
|
||||
s = requests.Session()
|
||||
s.headers['Authorization'] = f"Bearer {confluence_pat}"
|
||||
confluence = Confluence(url=confluence_host, session=s)
|
||||
|
||||
def recurse_child_pages(page_id, level=0):
|
||||
level += 1
|
||||
|
||||
child_pages = confluence.get_page_child_by_type(page_id, type='page', start=None, limit=None, expand=None)
|
||||
for child_page in child_pages:
|
||||
page_title = child_page["title"]
|
||||
st = "\t" * level
|
||||
logger.info(f"{st}Page {page_title}")
|
||||
if page_title.find('[WGWR3]') != -1:
|
||||
rename_page_title(child_page["id"], child_page["title"])
|
||||
recurse_child_pages(child_page["id"], level=level)
|
||||
|
||||
def rename_page_title(page_id, page_title):
|
||||
#append 'WGWR2'
|
||||
#Confluence.update_page(page_id, title='WGWR2_' , body, parent_id=None, type='page', representation='storage', minor_edit=False, full_width=False)
|
||||
page_title = page_title.replace('[WGWR3]','WGWR3_')
|
||||
|
||||
# Get old page contents
|
||||
page_content = confluence.get_page_by_id(page_id=page_id, expand='body') # Old page contents
|
||||
|
||||
#Rename and move page, get updated content
|
||||
#new_page_content = confluence.update_page(old_page_content['id'], title=new_title, body=old_page_content['body'], parent_id=parent_id, type="page", representation="storage")
|
||||
confluence.update_page(page_id=page_id, title=page_title) #, body=page_content['body'])
|
||||
logger.info(f"New page title '{page_title}'")
|
||||
|
||||
# get main page
|
||||
#Confluence.get_page_by_id(page_id, expand=None, status=None, version=None)
|
||||
#page = Confluence.get_page_child_by_type('Wiener Gebäude- und Wohnungsregister', 'WGWR2')
|
||||
|
||||
#page_id = 118856417 # WGWR2
|
||||
page_id = 280660965 # WGWR3
|
||||
|
||||
recurse_child_pages(page_id=page_id)
|
||||
|
||||
#body = page["body"]["storage"]["value"]
|
||||
@@ -17,10 +17,11 @@ logging.basicConfig(filename='sprint efforts.log',
|
||||
|
||||
host = "https://jira.wien.gv.at/"
|
||||
pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"
|
||||
sprint = 9
|
||||
sprint = 1
|
||||
project = 'WRWGR3'
|
||||
|
||||
row = 0; col = 0
|
||||
workbook = xlsxwriter.Workbook(f'efforts sprint {sprint} (from comment).xlsx')
|
||||
workbook = xlsxwriter.Workbook(f'efforts {project} sprint {sprint} (from comment).xlsx')
|
||||
worksheet = workbook.add_worksheet('efforts')
|
||||
|
||||
cell_format = workbook.add_format()
|
||||
@@ -39,8 +40,8 @@ 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 (WRGWR-2838, WRGWR-2839)') #, 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('Sum effort stored in issue-comments of pre-planning sprint {}'.format(sprint))
|
||||
|
||||
@@ -16,7 +16,7 @@ logging.basicConfig(filename='sprint efforts.log',
|
||||
|
||||
host = "https://jira.wien.gv.at/"
|
||||
pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"
|
||||
sprint = 9
|
||||
sprint = 2
|
||||
|
||||
row = 0; col = 0
|
||||
workbook = xlsxwriter.Workbook(f'efforts sprint {sprint}.xlsx')
|
||||
@@ -38,8 +38,8 @@ 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 (wrgwr-856, dkarb-367)', expand='changelog')
|
||||
issues_Jql = jira_server.search_issues('filter=25827') #, 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')
|
||||
|
||||
|
||||
@@ -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 != "":
|
||||
@@ -134,7 +143,11 @@ 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
|
||||
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:
|
||||
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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user