~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/model/bugbranch.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-05-04 19:46:26 UTC
  • mfrom: (12965.1.2 bug-746866)
  • Revision ID: launchpad@pqm.canonical.com-20110504194626-ivi6516ooki1sl4z
[r=abentley][bug=746866] more efficient visibility query for
        BugBranchSet.getBranchesWithVisibleBugs()

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
    )
19
19
from storm.expr import (
20
20
    And,
 
21
    Exists,
21
22
    Or,
22
23
    Select,
23
24
    )
99
100
            # ones they may be directly or indirectly subscribed to.
100
101
            subscribed = And(
101
102
                TeamParticipation.teamID == BugSubscription.person_id,
102
 
                TeamParticipation.personID == user.id)
 
103
                TeamParticipation.personID == user.id,
 
104
                Bug.id == BugSubscription.bug_id)
103
105
 
104
106
            visible = And(
105
107
                Bug.id == BugBranch.bugID,
106
108
                Or(
107
109
                    Bug.private == False,
108
 
                    Bug.id.is_in(Select(
109
 
                        columns=[BugSubscription.bug_id],
 
110
                    Exists(Select(
 
111
                        columns=[True],
110
112
                        tables=[BugSubscription, TeamParticipation],
111
113
                        where=subscribed))))
112
114