aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gall <tom.gall@linaro.org>2015-05-18 13:59:49 -0500
committerTom Gall <tom.gall@linaro.org>2015-05-18 13:59:49 -0500
commit546240e5b01c61e5be0f7abd65244e1ad2f8d2df (patch)
tree5e0a1faee834c6d5e04b9f6f049c3a64123f8e40
parentaf5abe4af7493772f5ff5c160b33a8587f11f927 (diff)
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.
-rwxr-xr-xmonthly-report.py19
1 files 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, '<table border=0>'
for issue in db_sorted:
print >>outfile, '<tr><td>&nbsp;&nbsp;</td><td><b>' + linkit(issue['key']) + ' - ' + issue['summary'] + '</b><br>'
+ print >>outfile, 'Team: ' + issue['team'] + '<br>'
print >>outfile, 'Status: ' + issue['status']
print >>outfile, ', Target Delivery: ' + issue['fixversion']
if issue['confidence'] is None: