[Python-Dev] Small RFEs and the Bug Tracker

Virgil Dupras hsoft at hardcoded.net
Tue Feb 19 10:42:02 CET 2008

On 2/19/08, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > No, I don't, which is why I would find it interesting to run some
> > queries on the roundup database to have completion statistics for low
> > activity tickets. Is is possible to get a copy of that db somehow?
> I would rather not make it available, as it contains certain
> privacy-related information that we need to withhold. If you provide
> some SQL statement or Python script that you want me to run on the
> server - that should be possible.

Hum, Roundup has a rather nice little API to it's issues. Here we go.
It would be nice to have stats for 360 days as well.

#!/usr/bin/env python
# I'm building this out of a demo db of roundup, and it doesn't have a
"Resolution", so
# I'm doing guesswork here. It shouldn't be very hard to modify the
script to fit the
# python db.

import roundup.instance

def has_large_activity_gap(issue, db):
    for first, second in zip(issue.messages, issue.messages[1:]):
        date1 = db.msg.getnode(first).date
        date2 = db.msg.getnode(second).date
        if date2.differenceDate(date1).as_seconds() >=
            return True
    return False

tracker = roundup.instance.Tracker(PATH_TO_TRACKER)
db = tracker.open()
closed_status = db.status.lookup('chatting')
resolution2count = {}
for resolution_id in db.resolution.getnodeids():
    resolution2count[resolution_id] = 0
closed_issues = (db.issue.getnode(issue_id) for issue_id in
low_activity_issues = (issue for issue in closed_issues if
has_large_activity_gap(issue, db))
for issue in low_activity_issues:
    resolution2count[issue.resolution] += 1
print 'Low activity tickets (%d days) broken down per resolution
for resolution_id, count in resolution2count.items():
    resolution = db.resolution.getnode(resolution_id)
    print '%s\t%d' % (resolution.name, count)

More information about the Python-Dev mailing list