Merge lp:~matthew.revell/launchpad/bug-heat-help-bug-544799 into lp:launchpad

Proposed by Matthew Revell
Status: Merged
Approved by: Matthew Revell
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~matthew.revell/launchpad/bug-heat-help-bug-544799
Merge into: lp:launchpad
Diff against target: 278 lines (+206/-5)
6 files modified
lib/canonical/launchpad/icing/style-3-0.css.in (+3/-0)
lib/lp/bugs/browser/bugtask.py (+3/-2)
lib/lp/bugs/browser/tests/bug-heat-view.txt (+1/-1)
lib/lp/bugs/help/bug-heat.html (+191/-0)
lib/lp/bugs/scripts/bugheat.py (+4/-1)
lib/lp/bugs/scripts/tests/test_bugheat.py (+4/-1)
To merge this branch: bzr merge lp:~matthew.revell/launchpad/bug-heat-help-bug-544799
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code Approve
Michael Nelson (community) ui Approve
Canonical Launchpad Engineering Pending
Review via email: mp+24016@code.launchpad.net

Commit message

[r=intellectronica][ui=noodles] Adds a pop-up help link to each instance of the bug heat flames icon. It also introduces a new a.help.icon class that removes the underline (actually a border-bottom) where applied, so as not to have an unsightly and distracting underline on the bug heat icon.

Description of the change

This adds a help pop-up to the bug flames, wherever they're displayed.

You can view this here:

https://bugs.launchpad.dev/debian/+source/mozilla-firefox/+bug/3

and here:

https://bugs.launchpad.dev/debian/+source/mozilla-firefox/

It achieves this by adding an "a.help.icon" class to the stylesheet and applying that icon class to the help anchor surrounding the bug heat flames icon.

I've also moved the help pop-up styles from style.css to style-3-0.css.in

To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (3.3 KiB)

Thanks Matthew.

{{{
13:55 <mrevell> Something strange happened with my branch; I moved the styles, as you asked, and the underline returned. I moved them back and it's still there, so I've obviously done something without realising it. May I ask what the purpose of the move was?
13:56 <mrevell> Sorry, I'm getting called downstairs
13:56 <mrevell> bbl
13:56 <noodles775> Sure, we're trying to get rid of the old style.css, but we can only do it bit-by-bit, so we're starting with the general styles that we know are still in use.
--- Log closed Fri Apr 23 14:01:31 2010
--- Log opened Fri Apr 23 14:53:56 2010
14:53 -!- mrevellunch is now known as mrevell
14:54 <mrevell> Ah, I see
14:54 <mrevell> I'm gonna see if I can get this working again.
14:54 <noodles775> So that's strange that the underline returned. Did you try inspecting it (have you used firebug or chromium's developer tools? they're great for finding out what style is being applied)
14:55 <mrevell> I didn't use any tools, no. I'll give that a go, thanks. I'm using Chromium so will see what it can offer
14:58 <noodles775> Great, just make sure you've installed the package chromium-browser-inspector and then you should have the option available.
14:58 <mrevell> Aha
--- Log closed Fri Apr 23 15:03:31 2010
--- Log opened Fri Apr 23 15:35:38 2010
15:35 <mrevell> Hey, I've worked out what the problem is (I think). What I mentioned earlier about moving the style from one file to the other was a red herring. This issue seems to be that the default dotted border-bottom is applied to the <a> whereas the border: none is applied to the image, so the image doesn't have border but the anchor does.
15:36 <noodles775> Hrm.. so why was it working (or seemed to be working) earlier?
15:36 <noodles775> But that makes sense.
15:37 <mrevell> All I can think is that I'd not restarted my local instance (and so bugtask.py was still compiled with the inline style).
15:37 <noodles775> Yeah.
15:37 <noodles775> Question:
15:38 <noodles775> I noticed when looking at that branch, that the html generated from the browser *doesn't* include the class attribute (class="help"), where is it added?
15:38 <noodles775> I assume by some js somewhere?
15:38 <noodles775> Anyway, if it does it nicely, you should be able to add class="noborder" to the html generated in the browser code, and then update the style to:
15:39 <noodles775> a.help.noborder {....}
15:39 <mrevell> I believe so.
15:39 <noodles775> (no spaces in that selector).
15:39 <noodles775> Do you want to try that and see if it works?
15:39 <mrevell> Ah, thanks. I'll give that a go. thanks so much for your help
15:39 <noodles775> You can use the inspector to check that both classes are present when the page is generated (ie. it should be class="help noborder" or similar).
15:40 <noodles775> No problems!
--- Log closed Fri Apr 23 15:45:31 2010
--- Log opened Fri Apr 23 15:47:55 2010
15:47 <mrevell> That worked beautifully; thanks.
15:48 <noodles775> Excellent!
15:48 <noodles775> Oh,
15:49 <noodles775> Sorry, I just realised, that class="icon" would actually be more meaningful, rather than "noborder" (which is a presentation thing). Hrm, forget it, that's just too peda...

Read more...

review: Approve (ui)
Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/style-3-0.css.in'
2--- lib/canonical/launchpad/icing/style-3-0.css.in 2010-04-26 22:40:02 +0000
3+++ lib/canonical/launchpad/icing/style-3-0.css.in 2010-04-28 13:34:36 +0000
4@@ -233,6 +233,9 @@
5 a.help:hover, a.help:hover {
6 text-decoration: none;
7 }
8+a.help.icon {
9+ border: none;
10+}
11 img, a img {
12 /* No border on images that are links. */
13 border: none;
14
15=== modified file 'lib/lp/bugs/browser/bugtask.py'
16--- lib/lp/bugs/browser/bugtask.py 2010-04-17 11:58:39 +0000
17+++ lib/lp/bugs/browser/bugtask.py 2010-04-28 13:34:36 +0000
18@@ -1121,8 +1121,9 @@
19 max_bug_heat = 5000
20 heat_ratio = calculate_heat_display(bugtask.bug.heat, max_bug_heat)
21 html = (
22- '<span><img src="/@@/bug-heat-%(ratio)i.png" '
23- 'alt="%(ratio)i out of 4 heat flames" title="Heat: %(heat)i" />'
24+ '<span><a href="/+help/bug-heat.html" target="help" class="icon"><img'
25+ ' src="/@@/bug-heat-%(ratio)i.png" '
26+ 'alt="%(ratio)i out of 4 heat flames" title="Heat: %(heat)i" /></a>'
27 '</span>'
28 % {'ratio': heat_ratio, 'heat': bugtask.bug.heat})
29 return html
30
31=== modified file 'lib/lp/bugs/browser/tests/bug-heat-view.txt'
32--- lib/lp/bugs/browser/tests/bug-heat-view.txt 2010-03-12 16:55:49 +0000
33+++ lib/lp/bugs/browser/tests/bug-heat-view.txt 2010-04-28 13:34:36 +0000
34@@ -12,7 +12,7 @@
35 >>> def print_flames(bugtask, target=None):
36 ... html = bugtask_heat_html(bugtask, target=target)
37 ... soup = BeautifulSoup(html)
38- ... for img in soup.span.contents:
39+ ... for img in soup.span.a.contents:
40 ... print img['src']
41 ... print img['alt']
42 ... print img['title']
43
44=== added file 'lib/lp/bugs/help/bug-heat.html'
45--- lib/lp/bugs/help/bug-heat.html 1970-01-01 00:00:00 +0000
46+++ lib/lp/bugs/help/bug-heat.html 2010-04-28 13:34:36 +0000
47@@ -0,0 +1,191 @@
48+<html>
49+ <head>
50+ <title>Bug heat</title>
51+ <link rel="stylesheet" type="text/css"
52+ href="/+icing/yui/cssreset/reset.css" />
53+ <link rel="stylesheet" type="text/css"
54+ href="/+icing/yui/cssfonts/fonts.css" />
55+ <link rel="stylesheet" type="text/css"
56+ href="/+icing/yui/cssbase/base.css" />
57+ </head>
58+ <body>
59+ <h1>Bug heat</h1>
60+
61+ <p>
62+ Launchpad helps you to appraise a bug by giving you a calculated measure
63+ &mdash; called bug heat &mdash; of its likely significance.
64+ </p>
65+
66+ <p>
67+ You can see bug heat in bug listings, and also on individual bug pages,
68+ as four flames: the more flames that are lit, the higher the bug's
69+ <em>heat</em>.
70+ </p>
71+
72+ <p>
73+ Launchpad works out how many flames to light by calculating a bug heat
74+ score and then seeing how that compares with the bug heat of other bugs
75+ for that project. If you want to see the bug heat score itself, hover
76+ your mouse over the flames icon.
77+ </p>
78+
79+ <p>
80+ To calculate the bug heat score, Launchpad looks at the bug's:
81+ </p>
82+
83+ <ul>
84+ <li>privacy status</li>
85+ <li>security status</li>
86+ <li>number of subscribers</li>
87+ <li>number of duplicates</li>
88+ <li>number of people who've selected the "this bug affects me" option
89+ <li>length of time since the last action.</li>
90+ </ul>
91+
92+ <h2>How Launchpad calculates bug heat &mdash; the detailed version</h2>
93+
94+ <p>
95+ Here's exactly how Launchpad calculates the bug heat score. First
96+ Launchpad gives the bug a base score:
97+ </p>
98+
99+ <table width="100%">
100+ <tr>
101+ <th>
102+ <strong>Attribute</strong>
103+ </th>
104+ <th>
105+ <strong>Calculation</strong>
106+ </th>
107+ </tr>
108+
109+ <tr>
110+ <td>
111+ Private
112+ </td>
113+ <td>
114+ Adds 150 points
115+ </td>
116+ </tr>
117+
118+ <tr>
119+ <td>
120+ Security issue
121+ </td>
122+ <td>
123+ Adds 250 points
124+ </td>
125+ </tr>
126+
127+ <tr>
128+ <td>
129+ Duplicates
130+ </td>
131+ <td>
132+ Adds 6 points per duplicate bug
133+ </td>
134+ </tr>
135+
136+ <tr>
137+ <td>
138+ Affected users
139+ </td>
140+ <td>
141+ Adds 4 points per affected user
142+ </td>
143+ </tr>
144+
145+ <tr>
146+ <td>
147+ Subscribers (incl. subscribers to duplicates)
148+ </td>
149+ <td>
150+ Adds 2 points per subscriber
151+ </td>
152+ </tr>
153+ </table>
154+
155+ <p>
156+ Next, it adjusts the score depending on how active the bug is:
157+ </p>
158+
159+ <table width="100%">
160+ <tr>
161+ <th>
162+ <strong>Nature of recent activity</strong>
163+ </th>
164+ <th>
165+ <strong>Calculation</strong>
166+ </th>
167+ </tr>
168+
169+ <tr>
170+ <td>
171+ Bug has been active* within the past 24 hours
172+ </td>
173+ <td>
174+ Add 25% of the project's <em>hottest</em> bug's score divided by the
175+ number of days since the first activity on the bug in question
176+ </td>
177+ </tr>
178+ <tr>
179+ <td>
180+ Bug has <strong>not</strong> been active* in within the past 24
181+ hours
182+ </td>
183+ <td>
184+ Subtract 1% of the bug heat score for every day of inactivity
185+ </td>
186+ </tr>
187+ </table>
188+
189+ <p>
190+ <small><em>* Activity is either a comment posted or some other update to
191+ the bug report.</em></small>
192+ </p>
193+
194+ <p>
195+ Some bug statuses will also affect the overall score:
196+ </p>
197+
198+ <table width="100%">
199+ <tr>
200+ <th>
201+ <strong>Status</strong>
202+ </th>
203+ <th>
204+ <strong>Affect on bug heat score</strong>
205+ </th>
206+ </tr>
207+ <tr>
208+ <td>
209+ Fix Released
210+ </td>
211+ <td rowspan="4">
212+ Reduces the total bug heat score to zero
213+ </td>
214+ <tr>
215+ <td>
216+ Invalid
217+ </td>
218+ </tr>
219+ <tr>
220+ <td>
221+ Won't Fix
222+ </td>
223+ </tr>
224+ <tr>
225+ <td>
226+ Expired
227+ </td>
228+ </tr>
229+ </table>
230+
231+ <p>
232+ <a target="_blank"
233+ href="http://bazaar.launchpad.net/~launchpad-pqm/launchpad/db-devel/annotate/head:/lib/lp/bugs/scripts/bugheat.py">
234+ View the Launchpad code that calculates bug heat &gt;</a>.
235+ </p>
236+
237+ </body>
238+</html>
239
240=== modified file 'lib/lp/bugs/scripts/bugheat.py'
241--- lib/lp/bugs/scripts/bugheat.py 2010-04-14 12:55:44 +0000
242+++ lib/lp/bugs/scripts/bugheat.py 2010-04-28 13:34:36 +0000
243@@ -24,6 +24,10 @@
244
245 class BugHeatCalculator:
246 """A class to calculate the heat for a bug."""
247+ # If you change the way that bug heat is calculated, remember to update
248+ # the description of how it is calculated at
249+ # /lib/lp/bugs/help/bug-heat.html and
250+ # https://help.launchpad.net/Bugs/BugHeat
251
252 def __init__(self, bug):
253 self.bug = bug
254@@ -87,4 +91,3 @@
255 total_heat = int(total_heat * (0.9 ** months))
256
257 return total_heat
258-
259
260=== modified file 'lib/lp/bugs/scripts/tests/test_bugheat.py'
261--- lib/lp/bugs/scripts/tests/test_bugheat.py 2010-04-14 12:55:44 +0000
262+++ lib/lp/bugs/scripts/tests/test_bugheat.py 2010-04-28 13:34:36 +0000
263@@ -17,6 +17,10 @@
264
265 class TestBugHeatCalculator(TestCaseWithFactory):
266 """Tests for the BugHeatCalculator class."""
267+ # If you change the way that bug heat is calculated, remember to update
268+ # the description of how it is calculated at
269+ # /lib/lp/bugs/help/bug-heat.html and
270+ # https://help.launchpad.net/Bugs/BugHeat
271
272 layer = LaunchpadZopelessLayer
273
274@@ -230,4 +234,3 @@
275
276 def test_suite():
277 return unittest.TestLoader().loadTestsFromName(__name__)
278-