~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugtarget.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-08 00:14:25 UTC
  • mfrom: (13165.2.2 bug-793809)
  • Revision ID: launchpad@pqm.canonical.com-20110608001425-i7noud89pt3iy93y
[r=wgrant][bug=793809] Use BugSummary to do tag portlet calculations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1405
1405
    def tags_cloud_data(self):
1406
1406
        """The data for rendering a tags cloud"""
1407
1407
        official_tags = self.context.official_bug_tags
1408
 
 
1409
 
        # Construct a dict of official and top 10 tags.
1410
 
        # getUsedBugTagsWithOpenCounts is expensive, so do the union in
1411
 
        # SQL. Also preseed with 0 for all the official tags, as gUBTWOC
1412
 
        # won't return unused ones.
1413
 
        top_ten = removeSecurityProxy(
1414
 
            self.context.getUsedBugTagsWithOpenCounts(self.user)[:10])
1415
 
        official = removeSecurityProxy(
1416
 
            self.context.getUsedBugTagsWithOpenCounts(
1417
 
                self.user, official_tags))
1418
 
        tags = dict((tag, 0) for tag in official_tags)
1419
 
        tags.update(dict(top_ten.union(official)))
1420
 
 
 
1408
        tags = self.context.getUsedBugTagsWithOpenCounts(
 
1409
            self.user, 10, official_tags)
1421
1410
        max_count = float(max([1] + tags.values()))
1422
1411
 
1423
1412
        return sorted(
1462
1451
    @property
1463
1452
    def tags_js_data(self):
1464
1453
        """Return the JSON representation of the bug tags."""
1465
 
        used_tags = dict(self.context.getUsedBugTagsWithOpenCounts(self.user))
1466
 
        official_tags = list(self.context.official_bug_tags)
 
1454
        used_tags = self.context.getUsedBugTagsWithOpenCounts(self.user)
 
1455
        official_tags = self.context.official_bug_tags
1467
1456
        return """<script type="text/javascript">
1468
1457
                      var used_bug_tags = %s;
1469
1458
                      var official_bug_tags = %s;