From 546240e5b01c61e5be0f7abd65244e1ad2f8d2df Mon Sep 17 00:00:00 2001 From: Tom Gall Date: Mon, 18 May 2015 13:59:49 -0500 Subject: As part of the query, the labels field is examined and a lable of the form Team-XXXX will be stored into the issue under 'team'. As part of the report the issues are sorted by team and the team is included as part of information reported for an issue. --- monthly-report.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/monthly-report.py b/monthly-report.py index 90b848f..e47cbc6 100755 --- a/monthly-report.py +++ b/monthly-report.py @@ -21,6 +21,7 @@ import sys import datetime import codecs import locale +import re import urllib3.contrib.pyopenssl urllib3.contrib.pyopenssl.inject_into_urllib3() @@ -29,7 +30,7 @@ DEFAULT_LOGGER_NAME = "test.log" logger = None __version__ = "2014.01.1" DEFAULT_LOGGER_NAME = "cards.dbg.log" - +teampattern = re.compile('Team-*', re.IGNORECASE) def connect_jira(logger): """Connect to Jira Instance @@ -104,15 +105,25 @@ def get_carddetails(jira, db, issues): for issue in issues: logger.debug(issue.key + ' [' + issue.fields.summary + ']') + team = "" + if issue.fields.labels.__len__() > 0: + logger.debug(', '.join(issue.fields.labels)) + for t in issue.fields.labels: + m = teampattern.match(t) + if m: + team = t[5:] + #iterate through each issue and add it to the database db.append({'key': issue.key, 'assignee': issue.fields.assignee.name if issue.fields.assignee is not None else "Unassigned", 'summary': issue.fields.summary, 'fixversion': issue.fields.fixVersions[0].name if issue.fields.fixVersions.__len__() > 0 else "" , + 'labels': ', '.join(issue.fields.labels) if issue.fields.labels.__len__() > 0 else "" , 'confidence': issue.fields.customfield_11200, 'status': issue.fields.status.name, 'rank': issue.fields.customfield_10900, - 'engineeringprogress': issue.renderedFields.customfield_10204}) + 'engineeringprogress': issue.renderedFields.customfield_10204, + 'team' : team}) def stripspecial(incoming): @@ -152,12 +163,14 @@ def constructquery(args): def report(jira, db, issues, outfile): """report - Report by user the amount of time logged (percentage) """ - db_sorted = sorted(db, key=lambda field: field['rank']) + #db_sorted = sorted(db, key=lambda field: field['rank']) + db_sorted = sorted(db, key=lambda field: field['team']) old_assignee = "" old_parent = "" print >>outfile, '' for issue in db_sorted: print >>outfile, '
  ' + linkit(issue['key']) + ' - ' + issue['summary'] + '
' + print >>outfile, 'Team: ' + issue['team'] + '
' print >>outfile, 'Status: ' + issue['status'] print >>outfile, ', Target Delivery: ' + issue['fixversion'] if issue['confidence'] is None: -- cgit v1.2.3