Virgil Dupras wrote:
On 2/19/08, Virgil Dupras <[EMAIL PROTECTED]> wrote:
closed_status = db.status.lookup('chatting')

Oops, replace 'chatting' with 'closed'

Ok, I ran the script. It said

Low activity tickets (180 days) broken down per resolution status:

- no selection -        547
wont fix        423
works for me    194
accepted        1233
fixed   2257
duplicate       176
later   49
invalid 275
postponed       20
out of date     304
remind  5
rejected        448

Attached is the updated script.

Notice that a day has more than 3600 seconds. With

if date2.differenceDate(date1).as_seconds() >= ACTIVITY_DAY_THRESHOLD * 24 * 3600

it gives

- no selection -        118
wont fix        189
works for me    62
accepted        310
fixed   611
duplicate       75
later   17
invalid 73
postponed       6
out of date     193
remind  1
rejected        180


Regards,
Martin
#!/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.
PATH_TO_TRACKER = '.'
ACTIVITY_DAY_THRESHOLD = 180

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() >= ACTIVITY_DAY_THRESHOLD * 3600:
            return True
    return False

tracker = roundup.instance.Tracker(PATH_TO_TRACKER)
db = tracker.open()
closed_status = db.status.lookup('closed')
resolution2count = {None:0}
for resolution_id in db.resolution.getnodeids():
    resolution2count[resolution_id] = 0
closed_issues = (db.issue.getnode(issue_id) for issue_id in db.issue.find(status=closed_status))
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 status:' % ACTIVITY_DAY_THRESHOLD
print
for resolution_id, count in resolution2count.items():
    if resolution_id is None:
        resolution = "- no selection -"
    else:
        resolution = db.resolution.getnode(resolution_id).name
    print '%s\t%d' % (resolution, count)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to