Merge lp:~brian-murray/arsenal/length-in-state into lp:~bryce/arsenal/2.x

Proposed by Brian Murray
Status: Merged
Approved by: Bryce Harrington
Approved revision: 1069
Merged at revision: 1073
Proposed branch: lp:~brian-murray/arsenal/length-in-state
Merge into: lp:~bryce/arsenal/2.x
Diff against target: 101 lines (+30/-7)
1 file modified
scripts/collect-bug-data (+30/-7)
To merge this branch: bzr merge lp:~brian-murray/arsenal/length-in-state
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Review via email: mp+114227@code.launchpad.net

Description of the change

This branch adds in a days-in-state search criteria which uses the filter_status_length from lpltk bzr revno 160. This allows you to do something like search for bugs assigned to the Canonical Foundations team with a status of In Progress and in that state for more than 30 days - kinda neat.

Additionally, when testing this I noticed that I was only getting tasks assigned to one team member because I was returning after the first participant was done. I've fixed this by creating a list of assigned tasks and returning that once all the participants have been iterated through.

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/collect-bug-data'
2--- scripts/collect-bug-data 2012-07-03 20:07:11 +0000
3+++ scripts/collect-bug-data 2012-07-10 16:21:25 +0000
4@@ -338,7 +338,12 @@
5 reopened = search_criteria['reopened']
6 except KeyError:
7 reopened = False
8-
9+
10+ try:
11+ statuslength = search_criteria['days-in-state']
12+ except KeyError:
13+ statuslength = False
14+
15 # ensure that only one of these are selected
16 count = 0
17 if search_assignees != '':
18@@ -361,7 +366,7 @@
19 'order_by': search_order}
20
21 if search_reporters != '':
22- tasks = []
23+ reported_tasks = []
24 for reporter in search_reporters:
25 search_reporter = self.lp.launchpad.people[reporter]
26 if search_reporter.is_team is False:
27@@ -369,6 +374,9 @@
28 tasks = distro.search_tasks(**search_args)
29 if reopened:
30 tasks.set_filter_reopened()
31+ if statuslength:
32+ tasks.set_filter_status_length(statuslength)
33+ reported_tasks.append(tasks)
34 else:
35 for participant in search_reporter.participants:
36 if participant.is_team:
37@@ -377,12 +385,16 @@
38 tasks = distro.search_tasks(**search_args)
39 if reopened:
40 tasks.set_filter_reopened()
41+ if statuslength:
42+ tasks.set_filter_status_length(statuslength)
43+ for task in tasks:
44+ reported_tasks.append(task)
45 if search_limit:
46- return tasks[:search_limit]
47+ return reported_tasks[:search_limit]
48 else:
49- return tasks
50+ return reported_tasks
51 if search_assignees != '':
52- tasks = []
53+ assigned_tasks = []
54 for assignee in search_assignees:
55 search_assignee = self.lp.launchpad.people[assignee]
56 if search_assignee.is_team is False:
57@@ -390,6 +402,9 @@
58 tasks = distro.search_tasks(**search_args)
59 if reopened:
60 tasks.set_filter_reopened()
61+ if statuslength:
62+ tasks.set_filter_status_length(statuslength)
63+ assigned_tasks.append(tasks)
64 search_assignee_names.append(search_assignee.name)
65 else:
66 for participant in search_assignee.participants:
67@@ -399,10 +414,14 @@
68 tasks = distro.search_tasks(**search_args)
69 if reopened:
70 tasks.set_filter_reopened()
71+ if statuslength:
72+ tasks.set_filter_status_length(statuslength)
73+ for task in tasks:
74+ assigned_tasks.append(task)
75 if search_limit:
76- return tasks[:search_limit]
77+ return assigned_tasks[:search_limit]
78 else:
79- return tasks
80+ return assigned_tasks
81 # Subscribers searches differently than assignee, participant.
82 # TODO: consolidate searching by these fields and make the splitting team
83 # into participants a configurable feature.
84@@ -413,6 +432,8 @@
85 tasks = distro.search_tasks(**search_args)
86 if reopened:
87 tasks.set_filter_reopened()
88+ if statuslength:
89+ tasks.set_filter_status_length(statuslength)
90 if search_limit:
91 return tasks[:search_limit]
92 else:
93@@ -421,6 +442,8 @@
94 tasks = distro.search_tasks(**search_args)
95 if reopened:
96 tasks.set_filter_reopened()
97+ if statuslength:
98+ tasks.set_filter_status_length(statuslength)
99 if search_limit:
100 return tasks[:search_limit]
101 else:

Subscribers

People subscribed via source and target branches

to all changes: