"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/weekly-report" between
roundup-1.6.1.tar.gz and roundup-2.0.0.tar.gz

About: Roundup is an highly customisable issue-tracking system with command-line, web and e-mail interfaces (written in Python).

weekly-report  (roundup-1.6.1):weekly-report  (roundup-2.0.0)
#! /usr/bin/env python #! /usr/bin/env python
# This script generates a simple report outlining the activity in one # This script generates a simple report outlining the activity in one
# tracker for the most recent week. # tracker for the most recent week.
# This script is free software, you may redistribute it # This script is free software, you may redistribute it
# and/or modify under the same terms as Python. # and/or modify under the same terms as Python.
from __future__ import print_function
import sys, math import sys, math
from roundup import instance, date from roundup import instance, date
# open the instance # open the instance
if len(sys.argv) != 2: if len(sys.argv) != 2:
print 'You need to specify an instance home dir' print('You need to specify an instance home dir')
instance_home = sys.argv[1] instance_home = sys.argv[1]
instance = instance.open(instance_home) instance = instance.open(instance_home)
db = instance.open('admin') db = instance.open('admin')
old = date.Date('-1w') old = date.Date('-1w')
created = [] created = []
summary = {} summary = {}
messages = [] messages = []
# loop through all the recently-active issues # loop through all the recently-active issues
for issue_id in db.issue.filter(None, {'activity': '-1w;'}): for issue_id in db.issue.filter(None, {'activity': '-1w;'}):
num = 0 num = 0
for x,ts,userid,action,data in db.issue.history(issue_id): for x,ts,userid,action,data in db.issue.history(issue_id):
if ts < old: continue if ts < old: continue
if action == 'create': if action == 'create':
created.append(issue_id) created.append(issue_id)
elif action == 'set' and data.has_key('messages'): elif action == 'set' and 'messages' in data:
num += 1 num += 1
summary.setdefault(db.issue.get(issue_id, 'status'), []).append(issue_id) summary.setdefault(db.issue.get(issue_id, 'status'), []).append(issue_id)
messages.append((num, issue_id)) messages.append((num, issue_id))
#print 'STATUS SUMMARY:' #print 'STATUS SUMMARY:'
#for k,v in summary.items(): #for k,v in summary.items():
# print k, len(v) # print k, len(v)
print '\nCREATED:' print('\nCREATED:')
print '\n'.join(['%s: %s'%(id, db.issue.get(id, 'title')) print('\n'.join(['%s: %s'%(id, db.issue.get(id, 'title'))
for id in created]) for id in created]))
print '\nRESOLVED:' print('\nRESOLVED:')
resolved_id = db.status.lookup('resolved') resolved_id = db.status.lookup('resolved')
print '\n'.join(['%s: %s'%(id, db.issue.get(id, 'title')) print('\n'.join(['%s: %s'%(id, db.issue.get(id, 'title'))
for id in summary.get(resolved_id, [])]) for id in summary.get(resolved_id, [])]))
print '\nTOP TEN MOST DISCUSSED:' print('\nTOP TEN MOST DISCUSSED:')
messages.sort() messages.sort()
messages.reverse() messages.reverse()
nmax = messages[0][0] nmax = messages[0][0]
fmt = '%%%dd - %%s: %%s'%(int(math.log(nmax, 10)) + 1) fmt = '%%%dd - %%s: %%s'%(int(math.log(nmax, 10)) + 1)
print '\n'.join([fmt%(num, id, db.issue.get(id, 'title')) print('\n'.join([fmt%(num, id, db.issue.get(id, 'title'))
for num, id in messages[:10]]) for num, id in messages[:10]]))
# vim: set filetype=python ts=4 sw=4 et si # vim: set filetype=python ts=4 sw=4 et si
 End of changes. 8 change blocks. 
11 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)