Merge lp://staging/~intellectronica/launchpad/scale-heat into lp://staging/launchpad/db-devel
- scale-heat
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+20065@code.staging.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote : | # |
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
1 | === modified file 'database/schema/comments.sql' |
2 | --- database/schema/comments.sql 2010-02-25 17:54:23 +0000 |
3 | +++ database/schema/comments.sql 2010-02-25 17:54:26 +0000 |
4 | @@ -461,7 +461,7 @@ |
5 | |
6 | COMMENT ON TABLE DistributionSourcePackage IS 'Representing a sourcepackage in a distribution across all distribution series.'; |
7 | COMMENT ON COLUMN DistributionSourcePackage.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on a particular a source package in a distribution.'; |
8 | -COMMENT ON COLUMN DistributionSourcePackage.max_heat IS 'The highest heat value across bugs for this source package.'; |
9 | +COMMENT ON COLUMN DistributionSourcePackage.max_bug_heat IS 'The highest heat value across bugs for this source package.'; |
10 | |
11 | -- DistributionSourcePackageCache |
12 | |
13 | @@ -611,7 +611,7 @@ |
14 | COMMENT 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.'; |
15 | COMMENT ON COLUMN Product.license_approved IS 'The Other/Open Source license has been approved by an administrator.'; |
16 | COMMENT ON COLUMN Product.remote_product IS 'The ID of this product on its remote bug tracker.'; |
17 | -COMMENT ON COLUMN Product.max_heat IS 'The highest heat value across bugs for this product.'; |
18 | +COMMENT ON COLUMN Product.max_bug_heat IS 'The highest heat value across bugs for this product.'; |
19 | |
20 | -- ProductLicense |
21 | COMMENT ON TABLE ProductLicense IS 'The licenses that cover the software for a product.'; |
22 | @@ -659,7 +659,6 @@ |
23 | translations imports from codehosting branch: None, templates only, templates |
24 | and translations. See TranslationsBranchImportMode.'; |
25 | COMMENT ON COLUMN ProductSeries.translations_branch IS 'Branch to push translations updates to.'; |
26 | -COMMENT ON COLUMN ProductSeries.max_heat IS 'The highest heat value across bugs for this product series.'; |
27 | |
28 | -- ProductSeriesCodeImport |
29 | |
30 | @@ -704,7 +703,7 @@ |
31 | COMMENT ON COLUMN Project.logo IS 'The library file alias of a smaller version of this product''s mugshot.'; |
32 | COMMENT ON COLUMN Project.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on products in this project.'; |
33 | COMMENT 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.'; |
34 | -COMMENT ON COLUMN Project.max_heat IS 'The highest heat value across bugs for products in this project.'; |
35 | +COMMENT ON COLUMN Project.max_bug_heat IS 'The highest heat value across bugs for products in this project.'; |
36 | |
37 | -- ProjectRelationship |
38 | COMMENT 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").'; |
39 | @@ -968,7 +967,7 @@ |
40 | COMMENT ON COLUMN Distribution.enable_bug_expiration IS 'Indicates whether automatic bug expiration is enabled.'; |
41 | COMMENT ON COLUMN Distribution.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on this distribution.'; |
42 | COMMENT 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.'; |
43 | -COMMENT ON COLUMN Distribution.max_heat IS 'The highest heat value across bugs for this distribution.'; |
44 | +COMMENT ON COLUMN Distribution.max_bug_heat IS 'The highest heat value across bugs for this distribution.'; |
45 | |
46 | -- DistroSeries |
47 | |
48 | @@ -987,7 +986,6 @@ |
49 | COMMENT ON COLUMN DistroSeries.language_pack_delta IS 'Current language pack update based on language_pack_base information.'; |
50 | COMMENT 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.'; |
51 | COMMENT ON COLUMN DistroSeries.language_pack_full_export_requested IS 'Whether next language pack export should be a full export or an update.'; |
52 | -COMMENT ON COLUMN DistroSeries.max_heat IS 'The highest heat value across bugs for this distro series.'; |
53 | |
54 | |
55 | -- PackageDiff |
56 | |
57 | === renamed file 'database/schema/patch-2207-99-0.sql' => 'database/schema/patch-2207-34-0.sql' |
58 | --- database/schema/patch-2207-99-0.sql 2010-02-25 17:54:23 +0000 |
59 | +++ database/schema/patch-2207-34-0.sql 2010-02-25 17:54:26 +0000 |
60 | @@ -3,17 +3,9 @@ |
61 | |
62 | SET client_min_messages=ERROR; |
63 | |
64 | -ALTER TABLE product |
65 | - ADD COLUMN max_heat integer DEFAULT 0 NOT NULL; |
66 | -ALTER TABLE productseries |
67 | - ADD COLUMN max_heat integer DEFAULT 0 NOT NULL; |
68 | -ALTER TABLE project |
69 | - ADD COLUMN max_heat integer DEFAULT 0 NOT NULL; |
70 | -ALTER TABLE distribution |
71 | - ADD COLUMN max_heat integer DEFAULT 0 NOT NULL; |
72 | -ALTER TABLE distroseries |
73 | - ADD COLUMN max_heat integer DEFAULT 0 NOT NULL; |
74 | -ALTER TABLE distributionsourcepackage |
75 | - ADD COLUMN max_heat integer DEFAULT 0 NOT NULL; |
76 | +ALTER TABLE product ADD COLUMN max_bug_heat integer; |
77 | +ALTER TABLE project ADD COLUMN max_bug_heat integer; |
78 | +ALTER TABLE distribution ADD COLUMN max_bug_heat integer; |
79 | +ALTER TABLE distributionsourcepackage ADD COLUMN max_bug_heat integer; |
80 | |
81 | -INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 99, 0); |
82 | +INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 34, 0); |
83 | |
84 | === modified file 'lib/lp/bugs/browser/bugtask.py' |
85 | --- lib/lp/bugs/browser/bugtask.py 2010-02-25 17:54:23 +0000 |
86 | +++ lib/lp/bugs/browser/bugtask.py 2010-02-25 17:54:26 +0000 |
87 | @@ -35,6 +35,7 @@ |
88 | 'BugTasksAndNominationsView', |
89 | 'bugtask_heat_html', |
90 | 'BugsBugTaskSearchListingView', |
91 | + 'calculate_heat_display', |
92 | 'NominationsReviewTableBatchNavigatorView', |
93 | 'TextualBugTaskSearchListingView', |
94 | 'get_buglisting_search_filter_url', |
95 | @@ -50,7 +51,7 @@ |
96 | from simplejson import dumps |
97 | import urllib |
98 | from operator import attrgetter, itemgetter |
99 | -from math import floor |
100 | +from math import floor, log |
101 | |
102 | from zope import component |
103 | from zope.app.form import CustomWidgetFactory |
104 | @@ -1084,13 +1085,24 @@ |
105 | return bugtask_heat_html(self.context) |
106 | |
107 | |
108 | +def calculate_heat_display(heat, max_bug_heat): |
109 | + """Calculate the number of heat 'flames' to display.""" |
110 | + heat = float(heat) |
111 | + max_bug_heat = float(max_bug_heat) |
112 | + if heat / max_bug_heat < 0.33333: |
113 | + return 0 |
114 | + if heat / max_bug_heat < 0.66666: |
115 | + return int(floor((heat / max_bug_heat) * 4)) |
116 | + else: |
117 | + return int(floor((log(heat) / log(max_bug_heat)) * 4)) |
118 | + |
119 | + |
120 | def bugtask_heat_html(bugtask): |
121 | """Render the HTML representing bug heat for a given bugask.""" |
122 | - max_heat = bugtask.target.max_heat |
123 | - if max_heat == 0: |
124 | - max_heat = 5000 |
125 | - heat_ratio = floor( |
126 | - (bugtask.bug.heat / float(max_heat)) * 4) |
127 | + max_bug_heat = bugtask.target.max_bug_heat |
128 | + if max_bug_heat is None: |
129 | + max_bug_heat = 5000 |
130 | + heat_ratio = calculate_heat_display(bugtask.bug.heat, max_bug_heat) |
131 | html = '<span>' |
132 | for flame in range(1, 5): |
133 | if flame <= heat_ratio: |
134 | @@ -1982,10 +1994,7 @@ |
135 | @property |
136 | def bug_heat_html(self): |
137 | """Returns the bug heat flames HTML.""" |
138 | - view = getMultiAdapter( |
139 | - (self.bugtask.bug, self.request), |
140 | - name='+bug-heat') |
141 | - return view() |
142 | + return bugtask_heat_html(self.bugtask) |
143 | |
144 | |
145 | class BugListingBatchNavigator(TableBatchNavigator): |
146 | |
147 | === modified file 'lib/lp/bugs/browser/tests/bug-heat-view.txt' |
148 | --- lib/lp/bugs/browser/tests/bug-heat-view.txt 2010-02-25 17:54:23 +0000 |
149 | +++ lib/lp/bugs/browser/tests/bug-heat-view.txt 2010-02-25 17:54:26 +0000 |
150 | @@ -1,8 +1,8 @@ |
151 | = Bug heat view = |
152 | |
153 | Bug heat is represented as four flame icons. The quantity of flames that are |
154 | -coloured is dependent on the value of the heat field. The view BugHeatView |
155 | -is used to render the flames. |
156 | +coloured is dependent on the value of the heat field. The function |
157 | +bugtask_heat_html is used to render the flames. |
158 | |
159 | >>> MAX_HEAT = 5000.0 |
160 | >>> from canonical.launchpad.ftests import login, logout |
161 | @@ -21,7 +21,7 @@ |
162 | a heat of half the maximum will result in a display of two coloured flames |
163 | and two black-and-white flames. |
164 | |
165 | - >>> removeSecurityProxy(bug.default_bugtask.target).max_heat = MAX_HEAT |
166 | + >>> removeSecurityProxy(bug.default_bugtask.target).max_bug_heat = MAX_HEAT |
167 | >>> removeSecurityProxy(bug).heat = MAX_HEAT / 2 |
168 | >>> print_flames(bug.default_bugtask) |
169 | /@@/flame-icon |
170 | @@ -48,3 +48,37 @@ |
171 | /@@/flame-bw-icon |
172 | |
173 | >>> logout() |
174 | + |
175 | + |
176 | +== Scaling Bug Heat == |
177 | + |
178 | +To ensure a reasonable proportion of cold and hot bugs, the number used to |
179 | +calculate the number of flames to display is not a straight-forward ratio. |
180 | +Instead, we transform it by forcing low heat bugs to produce no flames and |
181 | +scaling the hottest bugs logarithmically. |
182 | + |
183 | + >>> from lp.bugs.browser.bugtask import calculate_heat_display |
184 | + >>> from math import floor |
185 | + |
186 | +Heat values less than a third of the maximum heat don't produce any flames. |
187 | + |
188 | + >>> print int(floor((300.0 / 1000.0) * 4)) |
189 | + 1 |
190 | + >>> print calculate_heat_display(300.0, 1000.0) |
191 | + 0 |
192 | + |
193 | +Heat values higher than a third of the max but lower than two thirds are treated |
194 | +as a straightforward ratio. |
195 | + |
196 | + >>> print int(floor((500.0 / 1000.0) * 4)) |
197 | + 2 |
198 | + >>> print calculate_heat_display(500.0, 1000.0) |
199 | + 2 |
200 | + |
201 | +Heat values higher than two thirds of the maximum heat are scaled upwards. |
202 | + |
203 | + >>> print int(floor((700.0 / 1000.0) * 4)) |
204 | + 2 |
205 | + >>> print calculate_heat_display(800.0, 1000.0) |
206 | + 3 |
207 | + |
208 | |
209 | === modified file 'lib/lp/bugs/interfaces/bugtarget.py' |
210 | --- lib/lp/bugs/interfaces/bugtarget.py 2010-02-25 17:54:23 +0000 |
211 | +++ lib/lp/bugs/interfaces/bugtarget.py 2010-02-25 17:54:26 +0000 |
212 | @@ -61,7 +61,7 @@ |
213 | description=_("The list of bug tags defined as official."), |
214 | value_type=Tag(), |
215 | readonly=True)) |
216 | - max_heat = Attribute( |
217 | + max_bug_heat = Attribute( |
218 | "The current highest bug heat value for this target.") |
219 | |
220 | @call_with(search_params=None, user=REQUEST_USER) |
221 | @@ -221,8 +221,8 @@ |
222 | None, all statuses will be included. |
223 | """ |
224 | |
225 | - def setMaxHeat(self, heat): |
226 | - """Set the max_heat for this context.""" |
227 | + def setMaxBugHeat(self, heat): |
228 | + """Set the max_bug_heat for this context.""" |
229 | |
230 | |
231 | class IBugTarget(IHasBugs): |
232 | |
233 | === modified file 'lib/lp/bugs/model/bugtarget.py' |
234 | --- lib/lp/bugs/model/bugtarget.py 2010-02-25 17:54:23 +0000 |
235 | +++ lib/lp/bugs/model/bugtarget.py 2010-02-25 17:54:26 +0000 |
236 | @@ -156,9 +156,9 @@ |
237 | |
238 | return self.searchTasks(all_tasks_query) |
239 | |
240 | - def setMaxHeat(self, heat): |
241 | + def setMaxBugHeat(self, heat): |
242 | """See `IHasBugs`.""" |
243 | - self.max_heat = heat |
244 | + self.max_bug_heat = heat |
245 | |
246 | def getBugCounts(self, user, statuses=None): |
247 | """See `IHasBugs`.""" |
248 | |
249 | === modified file 'lib/lp/bugs/tests/test_bugheat.py' |
250 | --- lib/lp/bugs/tests/test_bugheat.py 2010-02-25 17:54:23 +0000 |
251 | +++ lib/lp/bugs/tests/test_bugheat.py 2010-02-25 17:54:26 +0000 |
252 | @@ -216,30 +216,30 @@ |
253 | |
254 | |
255 | class MaxHeatByTargetBase: |
256 | - """Base class for testing a bug target's max_heat attribute.""" |
257 | + """Base class for testing a bug target's max_bug_heat attribute.""" |
258 | |
259 | layer = LaunchpadZopelessLayer |
260 | |
261 | target = None |
262 | factory = LaunchpadObjectFactory() |
263 | |
264 | - def test_target_max_heat_default(self): |
265 | - self.assertEqual(self.target.max_heat, 0) |
266 | + def test_target_max_bug_heat_default(self): |
267 | + self.assertEqual(self.target.max_bug_heat, None) |
268 | |
269 | - def test_set_target_max_heat(self): |
270 | - self.target.setMaxHeat(1000) |
271 | - self.assertEqual(self.target.max_heat, 1000) |
272 | + def test_set_target_max_bug_heat(self): |
273 | + self.target.setMaxBugHeat(1000) |
274 | + self.assertEqual(self.target.max_bug_heat, 1000) |
275 | |
276 | |
277 | class ProjectMaxHeatByTargetTest(MaxHeatByTargetBase, unittest.TestCase): |
278 | - """Ensure a project has a max_heat value that can be set.""" |
279 | + """Ensure a project has a max_bug_heat value that can be set.""" |
280 | |
281 | def setUp(self): |
282 | self.target = self.factory.makeProduct() |
283 | |
284 | |
285 | class DistributionMaxHeatByTargetTest(MaxHeatByTargetBase, unittest.TestCase): |
286 | - """Ensure a distribution has a max_heat value that can be set.""" |
287 | + """Ensure a distribution has a max_bug_heat value that can be set.""" |
288 | |
289 | def setUp(self): |
290 | self.target = self.factory.makeDistribution() |
291 | @@ -247,7 +247,7 @@ |
292 | |
293 | class DistributionSourcePackageMaxHeatByTargetTest( |
294 | MaxHeatByTargetBase, unittest.TestCase): |
295 | - """Ensure a distro source package has a max_heat value that can be set.""" |
296 | + """Ensure distro source package has max_bug_heat value that can be set.""" |
297 | |
298 | def setUp(self): |
299 | self.target = self.factory.makeDistributionSourcePackage() |
300 | @@ -255,7 +255,7 @@ |
301 | |
302 | class SourcePackageMaxHeatByTargetTest( |
303 | MaxHeatByTargetBase, unittest.TestCase): |
304 | - """Ensure a source package has a max_heat value that can be set.""" |
305 | + """Ensure a source package has a max_bug_heat value that can be set.""" |
306 | |
307 | def setUp(self): |
308 | self.target = self.factory.makeSourcePackage() |
309 | @@ -263,7 +263,7 @@ |
310 | |
311 | class ProductSeriesMaxHeatByTargetTest( |
312 | MaxHeatByTargetBase, unittest.TestCase): |
313 | - """Ensure a product series has a max_heat value that can be set.""" |
314 | + """Ensure a product series has a max_bug_heat value that can be set.""" |
315 | |
316 | def setUp(self): |
317 | self.target = self.factory.makeProductSeries() |
318 | @@ -271,7 +271,7 @@ |
319 | |
320 | class DistroSeriesMaxHeatByTargetTest( |
321 | MaxHeatByTargetBase, unittest.TestCase): |
322 | - """Ensure a distro series has a max_heat value that can be set.""" |
323 | + """Ensure a distro series has a max_bug_heat value that can be set.""" |
324 | |
325 | def setUp(self): |
326 | self.target = self.factory.makeDistroSeries() |
327 | @@ -279,7 +279,7 @@ |
328 | |
329 | class ProjectGroupMaxHeatByTargetTest( |
330 | MaxHeatByTargetBase, unittest.TestCase): |
331 | - """Ensure a project group has a max_heat value that can be set.""" |
332 | + """Ensure a project group has a max_bug_heat value that can be set.""" |
333 | |
334 | def setUp(self): |
335 | self.target = self.factory.makeProject() |
336 | |
337 | === modified file 'lib/lp/registry/configure.zcml' |
338 | --- lib/lp/registry/configure.zcml 2010-02-18 09:04:51 +0000 |
339 | +++ lib/lp/registry/configure.zcml 2010-02-25 17:54:26 +0000 |
340 | @@ -407,7 +407,8 @@ |
341 | official_bug_tags |
342 | findRelatedArchives |
343 | findRelatedArchivePublications |
344 | - userHasBugSubscriptions"/> |
345 | + userHasBugSubscriptions |
346 | + max_bug_heat"/> |
347 | <require |
348 | permission="launchpad.AnyPerson" |
349 | attributes=" |
350 | |
351 | === modified file 'lib/lp/registry/model/distribution.py' |
352 | --- lib/lp/registry/model/distribution.py 2010-02-25 17:54:23 +0000 |
353 | +++ lib/lp/registry/model/distribution.py 2010-02-25 17:54:26 +0000 |
354 | @@ -178,7 +178,7 @@ |
355 | official_blueprints = BoolCol(dbName='official_blueprints', notNull=True, |
356 | default=False) |
357 | active = True # Required by IPillar interface. |
358 | - max_heat = Int(allow_none=False, default=0) |
359 | + max_bug_heat = Int() |
360 | |
361 | def __repr__(self): |
362 | return "<%s '%s' (%s)>" % ( |
363 | |
364 | === modified file 'lib/lp/registry/model/distributionsourcepackage.py' |
365 | --- lib/lp/registry/model/distributionsourcepackage.py 2010-02-25 17:54:23 +0000 |
366 | +++ lib/lp/registry/model/distributionsourcepackage.py 2010-02-25 17:54:26 +0000 |
367 | @@ -142,27 +142,25 @@ |
368 | _get_bug_reporting_guidelines, |
369 | _set_bug_reporting_guidelines) |
370 | |
371 | - def _get_max_heat(self): |
372 | - """See `IHasBugs`.""" |
373 | - dsp_in_db = self._self_in_database |
374 | - if dsp_in_db is None: |
375 | - dsp_in_db = DistributionSourcePackageInDatabase() |
376 | - dsp_in_db.sourcepackagename = self.sourcepackagename |
377 | - dsp_in_db.distribution = self.distribution |
378 | - Store.of(self.distribution).add(dsp_in_db) |
379 | - return dsp_in_db.max_heat |
380 | - |
381 | - def _set_max_heat(self, value): |
382 | - """See `IHasBugs`.""" |
383 | - dsp_in_db = self._self_in_database |
384 | - if dsp_in_db is None: |
385 | - dsp_in_db = DistributionSourcePackageInDatabase() |
386 | - dsp_in_db.sourcepackagename = self.sourcepackagename |
387 | - dsp_in_db.distribution = self.distribution |
388 | - Store.of(self.distribution).add(dsp_in_db) |
389 | - dsp_in_db.max_heat = value |
390 | - |
391 | - max_heat = property(_get_max_heat, _set_max_heat) |
392 | + def _get_max_bug_heat(self): |
393 | + """See `IHasBugs`.""" |
394 | + dsp_in_db = self._self_in_database |
395 | + if dsp_in_db is None: |
396 | + return None |
397 | + else: |
398 | + return dsp_in_db.max_bug_heat |
399 | + |
400 | + def _set_max_bug_heat(self, value): |
401 | + """See `IHasBugs`.""" |
402 | + dsp_in_db = self._self_in_database |
403 | + if dsp_in_db is None: |
404 | + dsp_in_db = DistributionSourcePackageInDatabase() |
405 | + dsp_in_db.sourcepackagename = self.sourcepackagename |
406 | + dsp_in_db.distribution = self.distribution |
407 | + Store.of(self.distribution).add(dsp_in_db) |
408 | + dsp_in_db.max_bug_heat = value |
409 | + |
410 | + max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat) |
411 | |
412 | @property |
413 | def latest_overall_publication(self): |
414 | @@ -497,5 +495,5 @@ |
415 | |
416 | bug_reporting_guidelines = Unicode() |
417 | |
418 | - max_heat = Int(allow_none=False, default=0) |
419 | + max_bug_heat = Int() |
420 | |
421 | |
422 | === modified file 'lib/lp/registry/model/distroseries.py' |
423 | --- lib/lp/registry/model/distroseries.py 2010-02-25 17:54:23 +0000 |
424 | +++ lib/lp/registry/model/distroseries.py 2010-02-25 17:54:26 +0000 |
425 | @@ -20,7 +20,7 @@ |
426 | BoolCol, StringCol, ForeignKey, SQLMultipleJoin, IntCol, |
427 | SQLObjectNotFound, SQLRelatedJoin) |
428 | |
429 | -from storm.locals import And, Desc, Int, Join, SQL |
430 | +from storm.locals import And, Desc, Join, SQL |
431 | from storm.store import Store |
432 | |
433 | from zope.component import getUtility |
434 | @@ -196,7 +196,6 @@ |
435 | sections = SQLRelatedJoin( |
436 | 'Section', joinColumn='distroseries', otherColumn='section', |
437 | intermediateTable='SectionSelection') |
438 | - max_heat = Int(allow_none=False, default=0) |
439 | |
440 | @property |
441 | def named_version(self): |
442 | @@ -624,6 +623,16 @@ |
443 | """See IBugTarget.""" |
444 | return self.fullseriesname |
445 | |
446 | + def _get_max_bug_heat(self): |
447 | + """See `IHasBugs`.""" |
448 | + return self.distribution.max_bug_heat |
449 | + |
450 | + def _set_max_bug_heat(self, value): |
451 | + """See `IHasBugs`.""" |
452 | + self.distribution.max_bug_heat = value |
453 | + |
454 | + max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat) |
455 | + |
456 | @property |
457 | def last_full_language_pack_exported(self): |
458 | return LanguagePack.selectFirstBy( |
459 | |
460 | === modified file 'lib/lp/registry/model/product.py' |
461 | --- lib/lp/registry/model/product.py 2010-02-25 17:54:23 +0000 |
462 | +++ lib/lp/registry/model/product.py 2010-02-25 17:54:26 +0000 |
463 | @@ -249,7 +249,7 @@ |
464 | dbName='official_rosetta', notNull=True, default=False) |
465 | remote_product = Unicode( |
466 | name='remote_product', allow_none=True, default=None) |
467 | - max_heat = Int(allow_none=False, default=0) |
468 | + max_bug_heat = Int() |
469 | |
470 | def _getMilestoneCondition(self): |
471 | """See `HasMilestonesMixin`.""" |
472 | |
473 | === modified file 'lib/lp/registry/model/productseries.py' |
474 | --- lib/lp/registry/model/productseries.py 2010-02-25 17:54:23 +0000 |
475 | +++ lib/lp/registry/model/productseries.py 2010-02-25 17:54:26 +0000 |
476 | @@ -18,7 +18,7 @@ |
477 | from storm.expr import Sum, Max |
478 | from zope.component import getUtility |
479 | from zope.interface import implements |
480 | -from storm.locals import And, Desc, Int |
481 | +from storm.locals import And, Desc |
482 | from storm.store import Store |
483 | |
484 | from canonical.database.constants import UTC_NOW |
485 | @@ -115,7 +115,6 @@ |
486 | # where are the tarballs released from this branch placed? |
487 | releasefileglob = StringCol(default=None) |
488 | releaseverstyle = StringCol(default=None) |
489 | - max_heat = Int(allow_none=False, default=0) |
490 | |
491 | packagings = SQLMultipleJoin('Packaging', joinColumn='productseries', |
492 | orderBy=['-id']) |
493 | @@ -161,6 +160,16 @@ |
494 | """See IBugTarget.""" |
495 | return "%s/%s" % (self.product.name, self.name) |
496 | |
497 | + def _get_max_bug_heat(self): |
498 | + """See `IHasBugs`.""" |
499 | + return self.product.max_bug_heat |
500 | + |
501 | + def _set_max_bug_heat(self, value): |
502 | + """See `IHasBugs`.""" |
503 | + self.product.max_bug_heat = value |
504 | + |
505 | + max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat) |
506 | + |
507 | @property |
508 | def drivers(self): |
509 | """See IProductSeries.""" |
510 | |
511 | === modified file 'lib/lp/registry/model/project.py' |
512 | --- lib/lp/registry/model/project.py 2010-02-25 17:54:23 +0000 |
513 | +++ lib/lp/registry/model/project.py 2010-02-25 17:54:26 +0000 |
514 | @@ -122,7 +122,7 @@ |
515 | foreignKey="BugTracker", dbName="bugtracker", notNull=False, |
516 | default=None) |
517 | bug_reporting_guidelines = StringCol(default=None) |
518 | - max_heat = Int(allow_none=False, default=0) |
519 | + max_bug_heat = Int() |
520 | |
521 | # convenient joins |
522 | |
523 | |
524 | === modified file 'lib/lp/registry/model/sourcepackage.py' |
525 | --- lib/lp/registry/model/sourcepackage.py 2010-02-25 17:54:23 +0000 |
526 | +++ lib/lp/registry/model/sourcepackage.py 2010-02-25 17:54:26 +0000 |
527 | @@ -443,15 +443,15 @@ |
528 | BugTask.sourcepackagename == self.sourcepackagename), |
529 | user) |
530 | |
531 | - def _get_max_heat(self): |
532 | - """See `IHasBugs`.""" |
533 | - return self.distribution_sourcepackage.max_heat |
534 | - |
535 | - def _set_max_heat(self, value): |
536 | - """See `IHasBugs`.""" |
537 | - self.distribution_sourcepackage.max_heat = value |
538 | - |
539 | - max_heat = property(_get_max_heat, _set_max_heat) |
540 | + def _get_max_bug_heat(self): |
541 | + """See `IHasBugs`.""" |
542 | + return self.distribution_sourcepackage.max_bug_heat |
543 | + |
544 | + def _set_max_bug_heat(self, value): |
545 | + """See `IHasBugs`.""" |
546 | + self.distribution_sourcepackage.max_bug_heat = value |
547 | + |
548 | + max_bug_heat = property(_get_max_bug_heat, _set_max_bug_heat) |
549 | |
550 | def createBug(self, bug_params): |
551 | """See canonical.launchpad.interfaces.IBugTarget.""" |
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.