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