~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2011-06-20 07:03:18 UTC
  • mto: (7675.1045.516 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13402.
  • Revision ID: robert@canonical.com-20110620070318-8hfk8vlcs7pbwn8g
replace countBugs with countBugs2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2526
2526
        """See `IBugTaskSet`."""
2527
2527
        return self._search(BugTask.bugID, [], None, params).result_set
2528
2528
 
2529
 
    def countBugs(self, params, group_on):
2530
 
        """See `IBugTaskSet`."""
2531
 
        resultset = self._search(
2532
 
            group_on + (SQL("COUNT(Distinct BugTask.bug)"),),
2533
 
            [], None, params).result_set
2534
 
        # We group on the related field:
2535
 
        resultset.group_by(*group_on)
2536
 
        resultset.order_by()
2537
 
        result = {}
2538
 
        for row in resultset:
2539
 
            result[row[:-1]] = row[-1]
2540
 
        return result
2541
 
 
2542
 
    def countBugs2(self, user, contexts, group_on):
 
2529
    def countBugs(self, user, contexts, group_on):
2543
2530
        """See `IBugTaskSet`."""
2544
2531
        # Circular fail.
2545
2532
        from lp.bugs.model.bugsummary import BugSummary