We pull the credentials from a config file and use them to get information out of jira about created tickets, completed tickets and tickets without an epic
46 lines
1.4 KiB
Python
Executable file
46 lines
1.4 KiB
Python
Executable file
#!/usr/bin/env python
|
|
import datetime
|
|
import logging
|
|
import pprint
|
|
import requests
|
|
import teamanalysis.config
|
|
import teamanalysis.jira
|
|
import teamanalysis.time
|
|
|
|
LOGGER = logging.getLogger('jira-summary')
|
|
|
|
def _get_without_epic(created):
|
|
without_epic = [issue for issue in created['issues'] if issue['fields']['customfield_10008'] is None]
|
|
return without_epic
|
|
|
|
def _show_summary(session, timepoint):
|
|
start, end = teamanalysis.time.get_checkpoint(timepoint)
|
|
created = teamanalysis.jira.issues_created_between(session, start, end)
|
|
without_epic = _get_without_epic(created)
|
|
resolved = teamanalysis.jira.issues_resolved_between(session, start, end)
|
|
print("\t".join([
|
|
start.date().isoformat(),
|
|
end.date().isoformat(),
|
|
str(created['total']),
|
|
str(resolved['total']),
|
|
str(len(without_epic)),
|
|
]))
|
|
|
|
def main():
|
|
logging.basicConfig()
|
|
logging.getLogger().setLevel(logging.DEBUG)
|
|
logging.getLogger('requests').setLevel(logging.INFO)
|
|
|
|
config = teamanalysis.config.get()
|
|
|
|
timepoint = datetime.datetime(2015, 5, 1, 0, 0, 1)
|
|
session = teamanalysis.jira.create_session(**config['jira'])
|
|
|
|
now = datetime.datetime.utcnow()
|
|
while timepoint < now + datetime.timedelta(days=7):
|
|
_show_summary(session, timepoint)
|
|
timepoint = timepoint + datetime.timedelta(days=7)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|