Merge lp://staging/~intellectronica/launchpad/scale-heat into lp://staging/launchpad/db-devel

Proposed by Eleanor Berger
Status: Merged
Approved by: Graham Binns
Approved revision: not available
Merged at revision: not available
Proposed branch: lp://staging/~intellectronica/launchpad/scale-heat
Merge into: lp://staging/launchpad/db-devel
Prerequisite: lp://staging/~intellectronica/launchpad/use-max-heat
Diff against target: 551 lines (+139/-89)
15 files modified
database/schema/comments.sql (+4/-6)
database/schema/patch-2207-34-0.sql (+5/-13)
lib/lp/bugs/browser/bugtask.py (+19/-10)
lib/lp/bugs/browser/tests/bug-heat-view.txt (+37/-3)
lib/lp/bugs/interfaces/bugtarget.py (+3/-3)
lib/lp/bugs/model/bugtarget.py (+2/-2)
lib/lp/bugs/tests/test_bugheat.py (+13/-13)
lib/lp/registry/configure.zcml (+2/-1)
lib/lp/registry/model/distribution.py (+1/-1)
lib/lp/registry/model/distributionsourcepackage.py (+20/-22)
lib/lp/registry/model/distroseries.py (+11/-2)
lib/lp/registry/model/product.py (+1/-1)
lib/lp/registry/model/productseries.py (+11/-2)
lib/lp/registry/model/project.py (+1/-1)
lib/lp/registry/model/sourcepackage.py (+9/-9)
To merge this branch: bzr merge lp://staging/~intellectronica/launchpad/scale-heat
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+20065@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

This branch adds a transformation to the value used to calculate the number of heat flames to display and adds a test explaining how it's done. In addition, I've corrected the narrative of the test which should have changed when I replaced a view with a function in a previous branch.

Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2010-02-25 17:54:23 +0000
+++ database/schema/comments.sql 2010-02-25 17:54:26 +0000
@@ -461,7 +461,7 @@
461461
462COMMENT ON TABLE DistributionSourcePackage IS 'Representing a sourcepackage in a distribution across all distribution series.';462COMMENT ON TABLE DistributionSourcePackage IS 'Representing a sourcepackage in a distribution across all distribution series.';
463COMMENT ON COLUMN DistributionSourcePackage.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on a particular a source package in a distribution.';463COMMENT ON COLUMN DistributionSourcePackage.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on a particular a source package in a distribution.';
464COMMENT ON COLUMN DistributionSourcePackage.max_heat IS 'The highest heat value across bugs for this source package.';464COMMENT ON COLUMN DistributionSourcePackage.max_bug_heat IS 'The highest heat value across bugs for this source package.';
465465
466-- DistributionSourcePackageCache466-- DistributionSourcePackageCache
467467
@@ -611,7 +611,7 @@
611COMMENT ON COLUMN Product.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';611COMMENT ON COLUMN Product.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';
612COMMENT ON COLUMN Product.license_approved IS 'The Other/Open Source license has been approved by an administrator.';612COMMENT ON COLUMN Product.license_approved IS 'The Other/Open Source license has been approved by an administrator.';
613COMMENT ON COLUMN Product.remote_product IS 'The ID of this product on its remote bug tracker.';613COMMENT ON COLUMN Product.remote_product IS 'The ID of this product on its remote bug tracker.';
614COMMENT ON COLUMN Product.max_heat IS 'The highest heat value across bugs for this product.';614COMMENT ON COLUMN Product.max_bug_heat IS 'The highest heat value across bugs for this product.';
615615
616-- ProductLicense616-- ProductLicense
617COMMENT ON TABLE ProductLicense IS 'The licenses that cover the software for a product.';617COMMENT ON TABLE ProductLicense IS 'The licenses that cover the software for a product.';
@@ -659,7 +659,6 @@
659translations imports from codehosting branch: None, templates only, templates659translations imports from codehosting branch: None, templates only, templates
660and translations. See TranslationsBranchImportMode.';660and translations. See TranslationsBranchImportMode.';
661COMMENT ON COLUMN ProductSeries.translations_branch IS 'Branch to push translations updates to.';661COMMENT ON COLUMN ProductSeries.translations_branch IS 'Branch to push translations updates to.';
662COMMENT ON COLUMN ProductSeries.max_heat IS 'The highest heat value across bugs for this product series.';
663662
664-- ProductSeriesCodeImport663-- ProductSeriesCodeImport
665664
@@ -704,7 +703,7 @@
704COMMENT ON COLUMN Project.logo IS 'The library file alias of a smaller version of this product''s mugshot.';703COMMENT ON COLUMN Project.logo IS 'The library file alias of a smaller version of this product''s mugshot.';
705COMMENT ON COLUMN Project.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on products in this project.';704COMMENT ON COLUMN Project.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on products in this project.';
706COMMENT ON COLUMN Project.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';705COMMENT ON COLUMN Project.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';
707COMMENT ON COLUMN Project.max_heat IS 'The highest heat value across bugs for products in this project.';706COMMENT ON COLUMN Project.max_bug_heat IS 'The highest heat value across bugs for products in this project.';
708707
709-- ProjectRelationship708-- ProjectRelationship
710COMMENT ON TABLE ProjectRelationship IS 'Project Relationships. This table stores information about the way projects are related to one another in the open source world. The actual nature of the relationship is stored in the ''label'' field, and possible values are given by the ProjectRelationship enum in dbschema.py. Examples are AGGREGATES ("the Gnome Project AGGREGATES EOG and Evolution and Gnumeric and AbiWord") and SIMILAR ("the Evolution project is SIMILAR to the Mutt project").';709COMMENT ON TABLE ProjectRelationship IS 'Project Relationships. This table stores information about the way projects are related to one another in the open source world. The actual nature of the relationship is stored in the ''label'' field, and possible values are given by the ProjectRelationship enum in dbschema.py. Examples are AGGREGATES ("the Gnome Project AGGREGATES EOG and Evolution and Gnumeric and AbiWord") and SIMILAR ("the Evolution project is SIMILAR to the Mutt project").';
@@ -968,7 +967,7 @@
968COMMENT ON COLUMN Distribution.enable_bug_expiration IS 'Indicates whether automatic bug expiration is enabled.';967COMMENT ON COLUMN Distribution.enable_bug_expiration IS 'Indicates whether automatic bug expiration is enabled.';
969COMMENT ON COLUMN Distribution.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on this distribution.';968COMMENT ON COLUMN Distribution.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on this distribution.';
970COMMENT ON COLUMN Distribution.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';969COMMENT ON COLUMN Distribution.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';
971COMMENT ON COLUMN Distribution.max_heat IS 'The highest heat value across bugs for this distribution.';970COMMENT ON COLUMN Distribution.max_bug_heat IS 'The highest heat value across bugs for this distribution.';
972971
973-- DistroSeries972-- DistroSeries
974973
@@ -987,7 +986,6 @@
987COMMENT ON COLUMN DistroSeries.language_pack_delta IS 'Current language pack update based on language_pack_base information.';986COMMENT ON COLUMN DistroSeries.language_pack_delta IS 'Current language pack update based on language_pack_base information.';
988COMMENT ON COLUMN DistroSeries.language_pack_proposed IS 'Either a full or update language pack being tested to be used in language_pack_base or language_pack_delta.';987COMMENT ON COLUMN DistroSeries.language_pack_proposed IS 'Either a full or update language pack being tested to be used in language_pack_base or language_pack_delta.';
989COMMENT ON COLUMN DistroSeries.language_pack_full_export_requested IS 'Whether next language pack export should be a full export or an update.';988COMMENT ON COLUMN DistroSeries.language_pack_full_export_requested IS 'Whether next language pack export should be a full export or an update.';
990COMMENT ON COLUMN DistroSeries.max_heat IS 'The highest heat value across bugs for this distro series.';
991989
992990
993-- PackageDiff991-- PackageDiff
994992
=== renamed file 'database/schema/patch-2207-99-0.sql' => 'database/schema/patch-2207-34-0.sql'
--- database/schema/patch-2207-99-0.sql 2010-02-25 17:54:23 +0000
+++ database/schema/patch-2207-34-0.sql 2010-02-25 17:54:26 +0000
@@ -3,17 +3,9 @@
33
4SET client_min_messages=ERROR;4SET client_min_messages=ERROR;
55
6ALTER TABLE product6ALTER TABLE product ADD COLUMN max_bug_heat integer;
7 ADD COLUMN max_heat integer DEFAULT 0 NOT NULL;7ALTER TABLE project ADD COLUMN max_bug_heat integer;
8ALTER TABLE productseries8ALTER TABLE distribution ADD COLUMN max_bug_heat integer;
9 ADD COLUMN max_heat integer DEFAULT 0 NOT NULL;9ALTER TABLE distributionsourcepackage ADD COLUMN max_bug_heat integer;
10ALTER TABLE project
11 ADD COLUMN max_heat integer DEFAULT 0 NOT NULL;
12ALTER TABLE distribution
13 ADD COLUMN max_heat integer DEFAULT 0 NOT NULL;
14ALTER TABLE distroseries
15 ADD COLUMN max_heat integer DEFAULT 0 NOT NULL;
16ALTER TABLE distributionsourcepackage
17 ADD COLUMN max_heat integer DEFAULT 0 NOT NULL;
1810
19INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 99, 0);11INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 34, 0);
2012
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-02-25 17:54:23 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-02-25 17:54:26 +0000
@@ -35,6 +35,7 @@
35 'BugTasksAndNominationsView',35 'BugTasksAndNominationsView',
36 'bugtask_heat_html',36 'bugtask_heat_html',
37 'BugsBugTaskSearchListingView',37 'BugsBugTaskSearchListingView',
38 'calculate_heat_display',
38 'NominationsReviewTableBatchNavigatorView',39 'NominationsReviewTableBatchNavigatorView',
39 'TextualBugTaskSearchListingView',40 'TextualBugTaskSearchListingView',
40 'get_buglisting_search_filter_url',41 'get_buglisting_search_filter_url',
@@ -50,7 +51,7 @@
50from simplejson import dumps51from simplejson import dumps
51import urllib52import urllib
52from operator import attrgetter, itemgetter53from operator import attrgetter, itemgetter
53from math import floor54from math import floor, log
5455
55from zope import component56from zope import component
56from zope.app.form import CustomWidgetFactory57from zope.app.form import CustomWidgetFactory
@@ -1084,13 +1085,24 @@
1084 return bugtask_heat_html(self.context)1085 return bugtask_heat_html(self.context)
10851086
10861087
1088def calculate_heat_display(heat, max_bug_heat):
1089 """Calculate the number of heat 'flames' to display."""
1090 heat = float(heat)
1091 max_bug_heat = float(max_bug_heat)
1092 if heat / max_bug_heat < 0.33333:
1093 return 0
1094 if heat / max_bug_heat < 0.66666:
1095 return int(floor((heat / max_bug_heat) * 4))
1096 else:
1097 return int(floor((log(heat) / log(max_bug_heat)) * 4))
1098
1099
1087def bugtask_heat_html(bugtask):1100def bugtask_heat_html(bugtask):
1088 """Render the HTML representing bug heat for a given bugask."""1101 """Render the HTML representing bug heat for a given bugask."""
1089 max_heat = bugtask.target.max_heat1102 max_bug_heat = bugtask.target.max_bug_heat
1090 if max_heat == 0:1103 if max_bug_heat is None:
1091 max_heat = 50001104 max_bug_heat = 5000
1092 heat_ratio = floor(1105 heat_ratio = calculate_heat_display(bugtask.bug.heat, max_bug_heat)
1093 (bugtask.bug.heat / float(max_heat)) * 4)
1094 html = '<span>'1106 html = '<span>'
1095 for flame in range(1, 5):1107 for flame in range(1, 5):
1096 if flame <= heat_ratio:1108 if flame <= heat_ratio:
@@ -1982,10 +1994,7 @@
1982 @property1994 @property
1983 def bug_heat_html(self):1995 def bug_heat_html(self):
1984 """Returns the bug heat flames HTML."""1996 """Returns the bug heat flames HTML."""
1985 view = getMultiAdapter(1997 return bugtask_heat_html(self.bugtask)
1986 (self.bugtask.bug, self.request),
1987 name='+bug-heat')
1988 return view()
19891998
19901999
1991class BugListingBatchNavigator(TableBatchNavigator):2000class BugListingBatchNavigator(TableBatchNavigator):
19922001
=== modified file 'lib/lp/bugs/browser/tests/bug-heat-view.txt'
--- lib/lp/bugs/browser/tests/bug-heat-view.txt 2010-02-25 17:54:23 +0000
+++ lib/lp/bugs/browser/tests/bug-heat-view.txt 2010-02-25 17:54:26 +0000
@@ -1,8 +1,8 @@
1= Bug heat view =1= Bug heat view =
22
3Bug heat is represented as four flame icons. The quantity of flames that are3Bug heat is represented as four flame icons. The quantity of flames that are
4coloured is dependent on the value of the heat field. The view BugHeatView4coloured is dependent on the value of the heat field. The function
5is used to render the flames.5bugtask_heat_html is used to render the flames.
66
7 >>> MAX_HEAT = 5000.07 >>> MAX_HEAT = 5000.0
8 >>> from canonical.launchpad.ftests import login, logout8 >>> from canonical.launchpad.ftests import login, logout
@@ -21,7 +21,7 @@
21a heat of half the maximum will result in a display of two coloured flames21a heat of half the maximum will result in a display of two coloured flames
22and two black-and-white flames.22and two black-and-white flames.
2323
24 >>> removeSecurityProxy(bug.default_bugtask.target).max_heat = MAX_HEAT24 >>> removeSecurityProxy(bug.default_bugtask.target).max_bug_heat = MAX_HEAT
25 >>> removeSecurityProxy(bug).heat = MAX_HEAT / 225 >>> removeSecurityProxy(bug).heat = MAX_HEAT / 2
26 >>> print_flames(bug.default_bugtask)26 >>> print_flames(bug.default_bugtask)
27 /@@/flame-icon27 /@@/flame-icon
@@ -48,3 +48,37 @@
48 /@@/flame-bw-icon48 /@@/flame-bw-icon
4949
50 >>> logout()50 >>> logout()
51
52
53== Scaling Bug Heat ==
54
55To ensure a reasonable proportion of cold and hot bugs, the number used to
56calculate the number of flames to display is not a straight-forward ratio.
57Instead, we transform it by forcing low heat bugs to produce no flames and
58scaling the hottest bugs logarithmically.
59
60 >>> from lp.bugs.browser.bugtask import calculate_heat_display
61 >>> from math import floor
62
63Heat values less than a third of the maximum heat don't produce any flames.
64
65 >>> print int(floor((300.0 / 1000.0) * 4))
66 1
67 >>> print calculate_heat_display(300.0, 1000.0)
68 0
69
70Heat values higher than a third of the max but lower than two thirds are treated
71as a straightforward ratio.
72
73 >>> print int(floor((500.0 / 1000.0) * 4))
74 2
75 >>> print calculate_heat_display(500.0, 1000.0)
76 2
77
78Heat values higher than two thirds of the maximum heat are scaled upwards.
79
80 >>> print int(floor((700.0 / 1000.0) * 4))
81 2
82 >>> print calculate_heat_display(800.0, 1000.0)
83 3
84
5185
=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
--- lib/lp/bugs/interfaces/bugtarget.py 2010-02-25 17:54:23 +0000
+++ lib/lp/bugs/interfaces/bugtarget.py 2010-02-25 17:54:26 +0000
@@ -61,7 +61,7 @@
61 description=_("The list of bug tags defined as official."),61 description=_("The list of bug tags defined as official."),
62 value_type=Tag(),62 value_type=Tag(),
63 readonly=True))63 readonly=True))
64 max_heat = Attribute(64 max_bug_heat = Attribute(
65 "The current highest bug heat value for this target.")65 "The current highest bug heat value for this target.")
6666
67 @call_with(search_params=None, user=REQUEST_USER)67 @call_with(search_params=None, user=REQUEST_USER)
@@ -221,8 +221,8 @@
221 None, all statuses will be included.221 None, all statuses will be included.
222 """222 """
223223
224 def setMaxHeat(self, heat):224 def setMaxBugHeat(self, heat):
225 """Set the max_heat for this context."""225 """Set the max_bug_heat for this context."""
226226
227227
228class IBugTarget(IHasBugs):228class IBugTarget(IHasBugs):
229229
=== modified file 'lib/lp/bugs/model/bugtarget.py'
--- lib/lp/bugs/model/bugtarget.py 2010-02-25 17:54:23 +0000
+++ lib/lp/bugs/model/bugtarget.py 2010-02-25 17:54:26 +0000
@@ -156,9 +156,9 @@
156156
157 return self.searchTasks(all_tasks_query)157 return self.searchTasks(all_tasks_query)
158158
159 def setMaxHeat(self, heat):159 def setMaxBugHeat(self, heat):
160 """See `IHasBugs`."""160 """See `IHasBugs`."""
161 self.max_heat = heat161 self.max_bug_heat = heat
162162
163 def getBugCounts(self, user, statuses=None):163 def getBugCounts(self, user, statuses=None):
164 """See `IHasBugs`."""164 """See `IHasBugs`."""
165165
=== modified file 'lib/lp/bugs/tests/test_bugheat.py'
--- lib/lp/bugs/tests/test_bugheat.py 2010-02-25 17:54:23 +0000
+++ lib/lp/bugs/tests/test_bugheat.py 2010-02-25 17:54:26 +0000
@@ -216,30 +216,30 @@
216216
217217
218class MaxHeatByTargetBase:218class MaxHeatByTargetBase:
219 """Base class for testing a bug target's max_heat attribute."""219 """Base class for testing a bug target's max_bug_heat attribute."""
220220
221 layer = LaunchpadZopelessLayer221 layer = LaunchpadZopelessLayer
222222
223 target = None223 target = None
224 factory = LaunchpadObjectFactory()224 factory = LaunchpadObjectFactory()
225225
226 def test_target_max_heat_default(self):226 def test_target_max_bug_heat_default(self):
227 self.assertEqual(self.target.max_heat, 0)227 self.assertEqual(self.target.max_bug_heat, None)
228228
229 def test_set_target_max_heat(self):229 def test_set_target_max_bug_heat(self):
230 self.target.setMaxHeat(1000)230 self.target.setMaxBugHeat(1000)
231 self.assertEqual(self.target.max_heat, 1000)231 self.assertEqual(self.target.max_bug_heat, 1000)
232232
233233
234class ProjectMaxHeatByTargetTest(MaxHeatByTargetBase, unittest.TestCase):234class ProjectMaxHeatByTargetTest(MaxHeatByTargetBase, unittest.TestCase):
235 """Ensure a project has a max_heat value that can be set."""235 """Ensure a project has a max_bug_heat value that can be set."""
236236
237 def setUp(self):237 def setUp(self):
238 self.target = self.factory.makeProduct()238 self.target = self.factory.makeProduct()
239239
240240
241class DistributionMaxHeatByTargetTest(MaxHeatByTargetBase, unittest.TestCase):241class DistributionMaxHeatByTargetTest(MaxHeatByTargetBase, unittest.TestCase):
242 """Ensure a distribution has a max_heat value that can be set."""242 """Ensure a distribution has a max_bug_heat value that can be set."""
243243
244 def setUp(self):244 def setUp(self):
245 self.target = self.factory.makeDistribution()245 self.target = self.factory.makeDistribution()
@@ -247,7 +247,7 @@
247247
248class DistributionSourcePackageMaxHeatByTargetTest(248class DistributionSourcePackageMaxHeatByTargetTest(
249 MaxHeatByTargetBase, unittest.TestCase):249 MaxHeatByTargetBase, unittest.TestCase):
250 """Ensure a distro source package has a max_heat value that can be set."""250 """Ensure distro source package has max_bug_heat value that can be set."""
251251
252 def setUp(self):252 def setUp(self):
253 self.target = self.factory.makeDistributionSourcePackage()253 self.target = self.factory.makeDistributionSourcePackage()
@@ -255,7 +255,7 @@
255255
256class SourcePackageMaxHeatByTargetTest(256class SourcePackageMaxHeatByTargetTest(
257 MaxHeatByTargetBase, unittest.TestCase):257 MaxHeatByTargetBase, unittest.TestCase):
258 """Ensure a source package has a max_heat value that can be set."""258 """Ensure a source package has a max_bug_heat value that can be set."""
259259
260 def setUp(self):260 def setUp(self):
261 self.target = self.factory.makeSourcePackage()261 self.target = self.factory.makeSourcePackage()
@@ -263,7 +263,7 @@
263263
264class ProductSeriesMaxHeatByTargetTest(264class ProductSeriesMaxHeatByTargetTest(
265 MaxHeatByTargetBase, unittest.TestCase):265 MaxHeatByTargetBase, unittest.TestCase):
266 """Ensure a product series has a max_heat value that can be set."""266 """Ensure a product series has a max_bug_heat value that can be set."""
267267
268 def setUp(self):268 def setUp(self):
269 self.target = self.factory.makeProductSeries()269 self.target = self.factory.makeProductSeries()
@@ -271,7 +271,7 @@
271271
272class DistroSeriesMaxHeatByTargetTest(272class DistroSeriesMaxHeatByTargetTest(
273 MaxHeatByTargetBase, unittest.TestCase):273 MaxHeatByTargetBase, unittest.TestCase):
274 """Ensure a distro series has a max_heat value that can be set."""274 """Ensure a distro series has a max_bug_heat value that can be set."""
275275
276 def setUp(self):276 def setUp(self):
277 self.target = self.factory.makeDistroSeries()277 self.target = self.factory.makeDistroSeries()
@@ -279,7 +279,7 @@
279279
280class ProjectGroupMaxHeatByTargetTest(280class ProjectGroupMaxHeatByTargetTest(
281 MaxHeatByTargetBase, unittest.TestCase):281 MaxHeatByTargetBase, unittest.TestCase):
282 """Ensure a project group has a max_heat value that can be set."""282 """Ensure a project group has a max_bug_heat value that can be set."""
283283
284 def setUp(self):284 def setUp(self):
285 self.target = self.factory.makeProject()285 self.target = self.factory.makeProject()
286286
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2010-02-18 09:04:51 +0000
+++ lib/lp/registry/configure.zcml 2010-02-25 17:54:26 +0000
@@ -407,7 +407,8 @@
407 official_bug_tags407 official_bug_tags
408 findRelatedArchives408 findRelatedArchives
409 findRelatedArchivePublications409 findRelatedArchivePublications
410 userHasBugSubscriptions"/>410 userHasBugSubscriptions
411 max_bug_heat"/>
411 <require412 <require
412 permission="launchpad.AnyPerson"413 permission="launchpad.AnyPerson"
413 attributes="414 attributes="
414415
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2010-02-25 17:54:23 +0000
+++ lib/lp/registry/model/distribution.py 2010-02-25 17:54:26 +0000
@@ -178,7 +178,7 @@
178 official_blueprints = BoolCol(dbName='official_blueprints', notNull=True,178 official_blueprints = BoolCol(dbName='official_blueprints', notNull=True,
179 default=False)179 default=False)
180 active = True # Required by IPillar interface.180 active = True # Required by IPillar interface.
181 max_heat = Int(allow_none=False, default=0)181 max_bug_heat = Int()
182182
183 def __repr__(self):183 def __repr__(self):
184 return "<%s '%s' (%s)>" % (184 return "<%s '%s' (%s)>" % (
185185
=== modified file 'lib/lp/registry/model/distributionsourcepackage.py'
--- lib/lp/registry/model/distributionsourcepackage.py 2010-02-25 17:54:23 +0000
+++ lib/lp/registry/model/distributionsourcepackage.py 2010-02-25 17:54:26 +0000
@@ -142,27 +142,25 @@
142 _get_bug_reporting_guidelines,142 _get_bug_reporting_guidelines,
143 _set_bug_reporting_guidelines)143 _set_bug_reporting_guidelines)
144144
145 def _get_max_heat(self):145 def _get_max_bug_heat(self):
146 """See `IHasBugs`."""146 """See `IHasBugs`."""
147 dsp_in_db = self._self_in_database147 dsp_in_db = self._self_in_database
148 if dsp_in_db is None:148 if dsp_in_db is None:
149 dsp_in_db = DistributionSourcePackageInDatabase()149 return None
150 dsp_in_db.sourcepackagename = self.sourcepackagename150 else:
151 dsp_in_db.distribution = self.distribution151 return dsp_in_db.max_bug_heat
152 Store.of(self.distribution).add(dsp_in_db)152
153 return dsp_in_db.max_heat153 def _set_max_bug_heat(self, value):
154154 """See `IHasBugs`."""
155 def _set_max_heat(self, value):155 dsp_in_db = self._self_in_database
156 """See `IHasBugs`."""156 if dsp_in_db is None:
157 dsp_in_db = self._self_in_database157 dsp_in_db = DistributionSourcePackageInDatabase()
158 if dsp_in_db is None:158 dsp_in_db.sourcepackagename = self.sourcepackagename
159 dsp_in_db = DistributionSourcePackageInDatabase()159 dsp_in_db.distribution = self.distribution
160 dsp_in_db.sourcepackagename = self.sourcepackagename160 Store.of(self.distribution).add(dsp_in_db)
161 dsp_in_db.distribution = self.distribution161 dsp_in_db.max_bug_heat = value
162 Store.of(self.distribution).add(dsp_in_db)162
163 dsp_in_db.max_heat = value163 max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat)
164
165 max_heat = property(_get_max_heat, _set_max_heat)
166164
167 @property165 @property
168 def latest_overall_publication(self):166 def latest_overall_publication(self):
@@ -497,5 +495,5 @@
497495
498 bug_reporting_guidelines = Unicode()496 bug_reporting_guidelines = Unicode()
499497
500 max_heat = Int(allow_none=False, default=0)498 max_bug_heat = Int()
501499
502500
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-02-25 17:54:23 +0000
+++ lib/lp/registry/model/distroseries.py 2010-02-25 17:54:26 +0000
@@ -20,7 +20,7 @@
20 BoolCol, StringCol, ForeignKey, SQLMultipleJoin, IntCol,20 BoolCol, StringCol, ForeignKey, SQLMultipleJoin, IntCol,
21 SQLObjectNotFound, SQLRelatedJoin)21 SQLObjectNotFound, SQLRelatedJoin)
2222
23from storm.locals import And, Desc, Int, Join, SQL23from storm.locals import And, Desc, Join, SQL
24from storm.store import Store24from storm.store import Store
2525
26from zope.component import getUtility26from zope.component import getUtility
@@ -196,7 +196,6 @@
196 sections = SQLRelatedJoin(196 sections = SQLRelatedJoin(
197 'Section', joinColumn='distroseries', otherColumn='section',197 'Section', joinColumn='distroseries', otherColumn='section',
198 intermediateTable='SectionSelection')198 intermediateTable='SectionSelection')
199 max_heat = Int(allow_none=False, default=0)
200199
201 @property200 @property
202 def named_version(self):201 def named_version(self):
@@ -624,6 +623,16 @@
624 """See IBugTarget."""623 """See IBugTarget."""
625 return self.fullseriesname624 return self.fullseriesname
626625
626 def _get_max_bug_heat(self):
627 """See `IHasBugs`."""
628 return self.distribution.max_bug_heat
629
630 def _set_max_bug_heat(self, value):
631 """See `IHasBugs`."""
632 self.distribution.max_bug_heat = value
633
634 max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat)
635
627 @property636 @property
628 def last_full_language_pack_exported(self):637 def last_full_language_pack_exported(self):
629 return LanguagePack.selectFirstBy(638 return LanguagePack.selectFirstBy(
630639
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2010-02-25 17:54:23 +0000
+++ lib/lp/registry/model/product.py 2010-02-25 17:54:26 +0000
@@ -249,7 +249,7 @@
249 dbName='official_rosetta', notNull=True, default=False)249 dbName='official_rosetta', notNull=True, default=False)
250 remote_product = Unicode(250 remote_product = Unicode(
251 name='remote_product', allow_none=True, default=None)251 name='remote_product', allow_none=True, default=None)
252 max_heat = Int(allow_none=False, default=0)252 max_bug_heat = Int()
253253
254 def _getMilestoneCondition(self):254 def _getMilestoneCondition(self):
255 """See `HasMilestonesMixin`."""255 """See `HasMilestonesMixin`."""
256256
=== modified file 'lib/lp/registry/model/productseries.py'
--- lib/lp/registry/model/productseries.py 2010-02-25 17:54:23 +0000
+++ lib/lp/registry/model/productseries.py 2010-02-25 17:54:26 +0000
@@ -18,7 +18,7 @@
18from storm.expr import Sum, Max18from storm.expr import Sum, Max
19from zope.component import getUtility19from zope.component import getUtility
20from zope.interface import implements20from zope.interface import implements
21from storm.locals import And, Desc, Int21from storm.locals import And, Desc
22from storm.store import Store22from storm.store import Store
2323
24from canonical.database.constants import UTC_NOW24from canonical.database.constants import UTC_NOW
@@ -115,7 +115,6 @@
115 # where are the tarballs released from this branch placed?115 # where are the tarballs released from this branch placed?
116 releasefileglob = StringCol(default=None)116 releasefileglob = StringCol(default=None)
117 releaseverstyle = StringCol(default=None)117 releaseverstyle = StringCol(default=None)
118 max_heat = Int(allow_none=False, default=0)
119118
120 packagings = SQLMultipleJoin('Packaging', joinColumn='productseries',119 packagings = SQLMultipleJoin('Packaging', joinColumn='productseries',
121 orderBy=['-id'])120 orderBy=['-id'])
@@ -161,6 +160,16 @@
161 """See IBugTarget."""160 """See IBugTarget."""
162 return "%s/%s" % (self.product.name, self.name)161 return "%s/%s" % (self.product.name, self.name)
163162
163 def _get_max_bug_heat(self):
164 """See `IHasBugs`."""
165 return self.product.max_bug_heat
166
167 def _set_max_bug_heat(self, value):
168 """See `IHasBugs`."""
169 self.product.max_bug_heat = value
170
171 max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat)
172
164 @property173 @property
165 def drivers(self):174 def drivers(self):
166 """See IProductSeries."""175 """See IProductSeries."""
167176
=== modified file 'lib/lp/registry/model/project.py'
--- lib/lp/registry/model/project.py 2010-02-25 17:54:23 +0000
+++ lib/lp/registry/model/project.py 2010-02-25 17:54:26 +0000
@@ -122,7 +122,7 @@
122 foreignKey="BugTracker", dbName="bugtracker", notNull=False,122 foreignKey="BugTracker", dbName="bugtracker", notNull=False,
123 default=None)123 default=None)
124 bug_reporting_guidelines = StringCol(default=None)124 bug_reporting_guidelines = StringCol(default=None)
125 max_heat = Int(allow_none=False, default=0)125 max_bug_heat = Int()
126126
127 # convenient joins127 # convenient joins
128128
129129
=== modified file 'lib/lp/registry/model/sourcepackage.py'
--- lib/lp/registry/model/sourcepackage.py 2010-02-25 17:54:23 +0000
+++ lib/lp/registry/model/sourcepackage.py 2010-02-25 17:54:26 +0000
@@ -443,15 +443,15 @@
443 BugTask.sourcepackagename == self.sourcepackagename),443 BugTask.sourcepackagename == self.sourcepackagename),
444 user)444 user)
445445
446 def _get_max_heat(self):446 def _get_max_bug_heat(self):
447 """See `IHasBugs`."""447 """See `IHasBugs`."""
448 return self.distribution_sourcepackage.max_heat448 return self.distribution_sourcepackage.max_bug_heat
449449
450 def _set_max_heat(self, value):450 def _set_max_bug_heat(self, value):
451 """See `IHasBugs`."""451 """See `IHasBugs`."""
452 self.distribution_sourcepackage.max_heat = value452 self.distribution_sourcepackage.max_bug_heat = value
453453
454 max_heat = property(_get_max_heat, _set_max_heat)454 max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat)
455455
456 def createBug(self, bug_params):456 def createBug(self, bug_params):
457 """See canonical.launchpad.interfaces.IBugTarget."""457 """See canonical.launchpad.interfaces.IBugTarget."""

Subscribers

People subscribed via source and target branches

to status/vote changes: