Merge lp:~stevenk/launchpad/no-more-o-n-queries-bug-dupes into lp:launchpad
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 16140 | ||||||||
Proposed branch: | lp:~stevenk/launchpad/no-more-o-n-queries-bug-dupes | ||||||||
Merge into: | lp:launchpad | ||||||||
Diff against target: |
345 lines (+88/-90) 5 files modified
lib/lp/bugs/browser/tests/test_bug_views.py (+25/-10) lib/lp/bugs/browser/tests/test_bugtask.py (+1/-1) lib/lp/bugs/model/bug.py (+25/-22) lib/lp/bugs/model/personsubscriptioninfo.py (+36/-56) lib/lp/bugs/model/tests/test_personsubscriptioninfo.py (+1/-1) |
||||||||
To merge this branch: | bzr merge lp:~stevenk/launchpad/no-more-o-n-queries-bug-dupes | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+129355@code.launchpad.net |
Commit message
Rewrite the heavy-lifting queries in IBug.getSubscri
Description of the change
Rewrite the heavy-lifting queries in IBug.getSubscri
Do a small number of whitespace function, and also rewrite IPersonSubscrip
8 - # XXX 2010-10-05 gmb bug=655597: getSubscribersF orPerson( self.user) )
9 - # This line of code keeps the view's query count down,
10 - # possibly using witchcraft. It should be rewritten to be
11 - # useful or removed in favour of making other queries more
12 - # efficient. The witchcraft is because the subscribers are accessed
13 - # in the initial page load, so the data is actually used.
14 - if self.user is not None:
15 - list(bug.
I'd suggest restoring this for now. We know the rest of the changes are probably safe, but about this we're just guessing. It's not detrimental to leave, since we deferred the plan to redesign the method.
153 tzinfo=pytz.UTC) subscription_ with(bug, person):
154 +
155 +def generate_
Looks like a missing newline.
155 +def generate_ subscription_ with(bug, person): bugsubscription s', Select( n.id, BugSubscription .person_ id), [BugSubscriptio n, Join( .bug_id) ], iptions' , Select( bugsubscription s.id'), bugsubscription s'), Join( on.teamID == SQL( ptions. person' ))], TeamParticipati on.personID == person.id]))]
156 + return [
157 + With('all_
158 + (BugSubscriptio
159 + tables=
160 + Bug, Bug.id == BugSubscription
161 + where=Or(Bug.id == bug.id, Bug.duplicateofID == bug.id))),
162 + With('bugsubscr
163 + SQL('all_
164 + tables=[
165 + SQL('all_
166 + TeamParticipation, TeamParticipati
167 + 'all_bugsubscri
168 + where=[
Some of the wrapping here is a bit off.
274 + pillar = self._getTaskPi llar(task)
Can you just use task.pillar instead?
292 + is_muted = Store.of( person) .find(
293 + BugMute, BugMute.bug == bug, BugMute.person == person).one()
294 + return is_muted is not None
This could even be 'return not Store.of( person) .find(BugMute, bug=bug, person= person) .is_empty( )'