"Fossies" - the Fresh Open Source Software Archive

Member "roundup-2.0.0/scripts/weekly-report" (26 Aug 2019, 1690 Bytes) of package /linux/www/roundup-2.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "weekly-report": 1.6.1_vs_2.0.0.

    1 #! /usr/bin/env python
    2 
    3 # This script generates a simple report outlining the activity in one
    4 # tracker for the most recent week.
    5 
    6 # This script is free software, you may redistribute it
    7 # and/or modify under the same terms as Python.
    8 
    9 from __future__ import print_function
   10 import sys, math
   11 from roundup import instance, date
   12 
   13 # open the instance
   14 if len(sys.argv) != 2:
   15     print('You need to specify an instance home dir')
   16 instance_home = sys.argv[1]
   17 instance = instance.open(instance_home)
   18 db = instance.open('admin')
   19 
   20 old = date.Date('-1w')
   21 
   22 created = []
   23 summary = {}
   24 messages = []
   25 
   26 # loop through all the recently-active issues
   27 for issue_id in db.issue.filter(None, {'activity': '-1w;'}):
   28     num = 0
   29     for x,ts,userid,action,data in db.issue.history(issue_id):
   30         if ts < old: continue
   31         if action == 'create':
   32             created.append(issue_id)
   33         elif action == 'set' and 'messages' in data:
   34             num += 1
   35     summary.setdefault(db.issue.get(issue_id, 'status'), []).append(issue_id)
   36     messages.append((num, issue_id))
   37 
   38 #print 'STATUS SUMMARY:'
   39 #for k,v in summary.items():
   40 #    print k, len(v)
   41 
   42 print('\nCREATED:')
   43 print('\n'.join(['%s: %s'%(id, db.issue.get(id, 'title'))
   44     for id in created]))
   45 
   46 print('\nRESOLVED:')
   47 resolved_id = db.status.lookup('resolved')
   48 print('\n'.join(['%s: %s'%(id, db.issue.get(id, 'title'))
   49     for id in summary.get(resolved_id, [])]))
   50 
   51 print('\nTOP TEN MOST DISCUSSED:')
   52 messages.sort()
   53 messages.reverse()
   54 nmax = messages[0][0]
   55 fmt = '%%%dd - %%s: %%s'%(int(math.log(nmax, 10)) + 1)
   56 print('\n'.join([fmt%(num, id, db.issue.get(id, 'title'))
   57     for num, id in messages[:10]]))
   58 
   59 # vim: set filetype=python ts=4 sw=4 et si