~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-19 20:40:37 UTC
  • mfrom: (13445.1.11 bug777874)
  • Revision ID: launchpad@pqm.canonical.com-20110719204037-t2ccggvcbuuf3sqr
[r=gary][no-qa] Revert unnecessary SQL change from
        https://code.launchpad.net/~gary/launchpad/bug777874 for QA
        simplicity, per discussion with Robert.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    Select,
61
61
    SQL,
62
62
    Sum,
 
63
    Union,
63
64
    )
64
65
from storm.info import ClassAlias
65
66
from storm.locals import (
444
445
    @property
445
446
    def user_ids_affected_with_dupes(self):
446
447
        """Return all IDs of Persons affected by this bug and its dupes.
447
 
        The return value is a Storm expression."""
448
 
        return Select(
449
 
            Person.id,
450
 
            And(BugAffectsPerson.person == Person.id,
451
 
                BugAffectsPerson.affected,
452
 
                Or(BugAffectsPerson.bug == self,
453
 
                   And(BugAffectsPerson.bug == Bug.id,
454
 
                       Bug.duplicateof == self.id))),
455
 
            distinct=True)
 
448
        The return value is a Storm expression.  Running a query with
 
449
        this expression returns a result that may contain the same ID
 
450
        multiple times, for example if that person is affected via
 
451
        more than one duplicate."""
 
452
        return Union(
 
453
            Select(Person.id,
 
454
                   And(BugAffectsPerson.person == Person.id,
 
455
                       BugAffectsPerson.affected,
 
456
                       BugAffectsPerson.bug == self)),
 
457
            Select(Person.id,
 
458
                   And(BugAffectsPerson.person == Person.id,
 
459
                       BugAffectsPerson.bug == Bug.id,
 
460
                       BugAffectsPerson.affected,
 
461
                       Bug.duplicateof == self.id)))
456
462
 
457
463
    @property
458
464
    def users_affected_with_dupes(self):