~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-11 05:00:44 UTC
  • mfrom: (14123.3.1 866100-affectsme-timeout)
  • Revision ID: launchpad@pqm.canonical.com-20111011050044-vippwbs915gz2xtc
[r=stub][bug=866100] Use a JOIN not an IN for BugAffectsPerson.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1867
1867
            decorator to call on each returned row.
1868
1868
        """
1869
1869
        params = self._require_params(params)
1870
 
        from lp.bugs.model.bug import Bug
 
1870
        from lp.bugs.model.bug import (
 
1871
            Bug,
 
1872
            BugAffectsPerson,
 
1873
            )
1871
1874
        extra_clauses = ['Bug.id = BugTask.bug']
1872
1875
        clauseTables = [BugTask, Bug]
1873
1876
        join_tables = []
2152
2155
        if params.affects_me:
2153
2156
            params.affected_user = params.user
2154
2157
        if params.affected_user:
2155
 
            affected_user_clause = """
2156
 
            BugTask.id IN (
2157
 
                SELECT BugTask.id FROM BugTask, BugAffectsPerson
2158
 
                WHERE BugTask.bug = BugAffectsPerson.bug
2159
 
                AND BugAffectsPerson.person = %(affected_user)s
2160
 
                AND BugAffectsPerson.affected = TRUE
2161
 
            )
2162
 
            """ % sqlvalues(affected_user=params.affected_user)
2163
 
            extra_clauses.append(affected_user_clause)
 
2158
            join_tables.append(
 
2159
                (BugAffectsPerson, Join(
 
2160
                    BugAffectsPerson, And(
 
2161
                        BugTask.bugID == BugAffectsPerson.bugID,
 
2162
                        BugAffectsPerson.affected,
 
2163
                        BugAffectsPerson.person == params.affected_user))))
2164
2164
 
2165
2165
        if params.nominated_for:
2166
2166
            mappings = sqlvalues(