Merge lp:~gmb/launchpad/add-next_check-to-bugwatch-pages-bug-558410 into lp:launchpad

Proposed by Graham Binns
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~gmb/launchpad/add-next_check-to-bugwatch-pages-bug-558410
Merge into: lp:launchpad
Diff against target: 237 lines (+112/-20)
4 files modified
lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt (+35/-12)
lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt (+42/-1)
lib/lp/bugs/templates/bugtracker-portlet-watches.pt (+14/-0)
lib/lp/bugs/templates/bugwatch-portlet-details.pt (+21/-7)
To merge this branch: bzr merge lp:~gmb/launchpad/add-next_check-to-bugwatch-pages-bug-558410
Reviewer Review Type Date Requested Status
Michael Nelson (community) ui Approve
Abel Deuring (community) code Approve
Review via email: mp+23080@code.launchpad.net

Commit message

Display the lastchecked and next_check values for BugWatches on the BugTracker overview and BugWatch +edit pages.

Description of the change

This branch changes the BugTracker overview and BugWatch +edit pages so
that they now display a watch's next_check and lastchecked columns. This
will give users a better idea of when to expect a bug watch to be
updated.

== lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt ==

 - I've added tests to cover the new "Last checked" and "Next check"
   columns.

== lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt ==

 - I've added tests to cover the new "Last checked" and "Scheduled"
   items on the page.

== lib/lp/bugs/templates/bugtracker-portlet-watches.pt ==

 - The lastchecked and next_check fields of each BugWatch are now
   displayed in the BugWatch table.

== lib/lp/bugs/templates/bugwatch-portlet-details.pt ==

 - The lastchecked and next_check fields of each BugWatch are now
   displayed on the +edit page.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)
Revision history for this message
Michael Nelson (michael.nelson) wrote :

Looks great Graham. I noticed you are using approximatedate for the 'Last checked' column, which I think is correct, as seeing 3 days ago would be more helpful to me than 2010-04-06, but it seems that approximatedate only does so if the timedelta is <= 1 day... do you know why this is?

Also why not simply use 'Last check' as the column heading? (ie. a noun, like 'Next check' and the other column headers).

Very insignificant thought regarding the ordering of the 2 col dls, would it be easier to scan if Created/Changed and Checked/Scheduled where vertically aligned like this:

Tracker | Remote bug id
Last status | Created
Checked | Changed
Scheduled | Created by

Anyway, approved either way.

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

On Fri, Apr 09, 2010 at 10:52:38AM -0000, Michael Nelson wrote:
> Review: Approve ui
> Looks great Graham. I noticed you are using approximatedate for the
> 'Last checked' column, which I think is correct, as seeing 3 days ago
> would be more helpful to me than 2010-04-06, but it seems that
> approximatedate only does so if the timedelta is <= 1 day... do you
> know why this is?

I don't know. Long forgotten design decision probably.

>
> Also why not simply use 'Last check' as the column heading? (ie. a
> noun, like 'Next check' and the other column headers).

No reason; I'll change it.

> Very insignificant thought regarding the ordering of the 2 col dls,
> would it be easier to scan if Created/Changed and Checked/Scheduled
> where vertically aligned like this:

True. I'll see if I can fix that in my next branch, which is going to
work on that page anyway.

> Tracker | Remote bug id
> Last status | Created
> Checked | Changed
> Scheduled | Created by
>
> Anyway, approved either way.

Thanks.

--
Graham Binns | PGP Key: EC66FA7D

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt'
2--- lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt 2009-09-18 15:24:30 +0000
3+++ lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt 2010-04-09 12:15:52 +0000
4@@ -537,16 +537,38 @@
5 When looking at a bug tracker page, a list of bug watches is
6 displayed:
7
8- >>> anon_browser.open(
9- ... 'http://launchpad.dev/bugs/bugtrackers/debbugs')
10- >>> print extract_text(find_tag_by_id(
11- ... anon_browser.contents, 'latestwatches'))
12- Launchpad bug Remote bug Status
13- #15: Nonsensical bugs are useless 308994 open important
14- #3: Bug Title Test 327549
15- #2: Blackhole Trash folder 327452
16- #1: Firefox does not support SVG 304014
17- #7: A test bug 280883
18+ >>> anon_browser.open(
19+ ... 'http://launchpad.dev/bugs/bugtrackers/debbugs')
20+ >>> print extract_text(find_tag_by_id(
21+ ... anon_browser.contents, 'latestwatches'))
22+ Launchpad bug Remote bug Status Last check Next check
23+ #15: Nonse... 308994 open...
24+ #3: Bug T... 327549
25+ #2: Black... 327452
26+ #1: Firef... 304014
27+ #7: A tes... 280883
28+
29+Scheduling any of the watches will change their "Next check" column.
30+
31+ >>> from datetime import datetime
32+ >>> from pytz import utc
33+
34+ >>> login('foo.bar@canonical.com')
35+ >>> debbugs = getUtility(IBugTrackerSet).getByName('debbugs')
36+ >>> watch_15 = debbugs.watches[0]
37+ >>> watch_15.next_check = datetime(2010, 4, 9, 9, 50, 0, tzinfo=utc)
38+ >>> logout()
39+
40+ >>> anon_browser.open(
41+ ... 'http://launchpad.dev/bugs/bugtrackers/debbugs')
42+ >>> print extract_text(find_tag_by_id(
43+ ... anon_browser.contents, 'latestwatches'))
44+ Launchpad bug Remote bug Status Last check Next check
45+ #15: Nonse... 308994 open... 2007-12-18 2010-04-09 09:50:00 UTC
46+ #3: Bug T... 327549
47+ #2: Black... 327452
48+ #1: Firef... 304014
49+ #7: A tes... 280883
50
51
52 === Private bugs ===
53@@ -565,7 +587,7 @@
54 ... 'http://launchpad.dev/bugs/bugtrackers/debbugs')
55 >>> print extract_text(find_tag_by_id(
56 ... anon_browser.contents, 'latestwatches'))
57- Launchpad bug Remote bug Status
58+ Launchpad bug Remote bug Status...
59 #15: (Private) -
60 #3: Bug Title Test 327549
61 #2: Blackhole Trash folder 327452
62@@ -615,7 +637,8 @@
63 ... watches = find_tag_by_id(
64 ... browser.contents, 'latestwatches').tbody.findAll('tr')
65 ... for watch in watches:
66- ... bug, remote_bug, status = watch.findAll('td')
67+ ... bug, remote_bug, status, last_checked, next_check = (
68+ ... watch.findAll('td'))
69 ... print extract_text(bug)
70 ... print ' --> %s: %s' % (
71 ... extract_text(remote_bug),
72
73=== modified file 'lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt'
74--- lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt 2009-06-12 16:36:02 +0000
75+++ lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt 2010-04-09 12:15:52 +0000
76@@ -1,4 +1,6 @@
77-= Edit a bug watch =
78+Edit a bug watch
79+================
80+
81
82 After a bug watch is recorded, it is possible to go back and change it.
83
84@@ -36,3 +38,42 @@
85 ... print extract_text(message)
86 There is 1 error.
87 "GELLER" is not a valid URI
88+
89+
90+BugWatch details
91+----------------
92+
93+The +edit page for a watch also displays some details about the watch.
94+
95+ >>> for data_tag in find_tags_by_class(
96+ ... admin_browser.contents, 'bugwatch-data'):
97+ ... print extract_text(data_tag.renderContents())
98+ Tracker: The Mozilla.org Bug Tracker
99+ Remote bug ID: 1000
100+ Last status: None recorded
101+ Changed: 2004-10-04
102+ Checked: 2004-10-04
103+ Next check: Not yet scheduled
104+ Created: 2004-10-04
105+ Created by: Mark Shuttleworth
106+
107+If we change the next_check date of the watch its will be shown in the
108+Next check column.
109+
110+ >>> from datetime import datetime
111+ >>> from pytz import utc
112+ >>> from zope.component import getUtility
113+
114+ >>> from canonical.launchpad.ftests import login, logout
115+ >>> from lp.bugs.interfaces.bugwatch import IBugWatchSet
116+
117+ >>> login('foo.bar@canonical.com')
118+ >>> watch = getUtility(IBugWatchSet).get(2)
119+ >>> watch.next_check = datetime(2010, 4, 8, 16, 07, tzinfo=utc)
120+ >>> logout()
121+
122+ >>> admin_browser.open('http://bugs.launchpad.dev/bugs/1/+watch/2')
123+ >>> data_tag = find_tag_by_id(
124+ ... admin_browser.contents, 'bugwatch-next_check')
125+ >>> print extract_text(data_tag.renderContents())
126+ Next check: 2010-04-08...
127
128=== modified file 'lib/lp/bugs/templates/bugtracker-portlet-watches.pt'
129--- lib/lp/bugs/templates/bugtracker-portlet-watches.pt 2009-09-01 15:34:12 +0000
130+++ lib/lp/bugs/templates/bugtracker-portlet-watches.pt 2010-04-09 12:15:52 +0000
131@@ -13,6 +13,8 @@
132 <th>Launchpad bug</th>
133 <th>Remote bug</th>
134 <th>Status</th>
135+ <th>Last check</th>
136+ <th>Next check</th>
137 </tr>
138 </thead>
139 <tbody>
140@@ -43,6 +45,18 @@
141 </a>
142 </td>
143 <td><tal:status tal:replace="watch/remotestatus"/></td>
144+ <td>
145+ <span
146+ tal:attributes="title watch/lastchecked/fmt:datetime"
147+ tal:content="watch/lastchecked/fmt:approximatedate">
148+ 13 Jan 2004
149+ </span>
150+ </td>
151+ <td>
152+ <span tal:content="watch/next_check/fmt:datetime">
153+ 13 Jan 2004
154+ </span>
155+ </td>
156 </tal:show-watch-details>
157 </tr>
158 </tal:watches>
159
160=== modified file 'lib/lp/bugs/templates/bugwatch-portlet-details.pt'
161--- lib/lp/bugs/templates/bugwatch-portlet-details.pt 2009-09-03 15:47:41 +0000
162+++ lib/lp/bugs/templates/bugwatch-portlet-details.pt 2010-04-09 12:15:52 +0000
163@@ -5,13 +5,13 @@
164 class="portlet">
165 <h2>Bug watch details</h2>
166 <div class="two-column-list">
167- <dl>
168+ <dl class="bugwatch-data">
169 <dt>Tracker:</dt>
170 <dd>
171 <a tal:replace="structure context/bugtracker/fmt:link"/>
172 </dd>
173 </dl>
174- <dl>
175+ <dl class="bugwatch-data">
176 <dt>Remote bug ID:</dt>
177 <dd>
178 <a tal:attributes="href context/url">
179@@ -19,7 +19,7 @@
180 </a>
181 </dd>
182 </dl>
183- <dl>
184+ <dl class="bugwatch-data">
185 <dt>Last status:</dt>
186 <dd>
187 <span tal:condition="not: context/remotestatus">
188@@ -28,7 +28,7 @@
189 <span tal:replace="context/remotestatus">6642</span>
190 </dd>
191 </dl>
192- <dl>
193+ <dl class="bugwatch-data">
194 <dt>Changed:</dt>
195 <dd>
196 <span
197@@ -38,7 +38,7 @@
198 </span>
199 </dd>
200 </dl>
201- <dl>
202+ <dl class="bugwatch-data">
203 <dt>Checked:</dt>
204 <dd>
205 <span
206@@ -48,7 +48,21 @@
207 </span>
208 </dd>
209 </dl>
210- <dl>
211+ <dl class="bugwatch-data" id="bugwatch-next_check">
212+ <dt>Next check:</dt>
213+ <dd>
214+ <span
215+ tal:condition="context/next_check"
216+ tal:content="context/next_check/fmt:datetime">
217+ 13 Jan 2004
218+ </span>
219+ <span
220+ tal:condition="not: context/next_check">
221+ Not yet scheduled
222+ </span>
223+ </dd>
224+ </dl>
225+ <dl class="bugwatch-data">
226 <dt>Created:</dt>
227 <dd>
228 <span
229@@ -58,7 +72,7 @@
230 </span>
231 </dd>
232 </dl>
233- <dl>
234+ <dl class="bugwatch-data">
235 <dt>Created by:</dt>
236 <dd>
237 <a tal:replace="structure context/owner/fmt:link" />