Merge lp:~gary-lasker/software-center/display-cached-recommendations into lp:software-center

Proposed by Gary Lasker
Status: Merged
Merged at revision: 3096
Proposed branch: lp:~gary-lasker/software-center/display-cached-recommendations
Merge into: lp:software-center
Diff against target: 18 lines (+8/-1)
1 file modified
softwarecenter/ui/gtk3/widgets/recommendations.py (+8/-1)
To merge this branch: bzr merge lp:~gary-lasker/software-center/display-cached-recommendations
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+119614@code.launchpad.net

Commit message

 * lp:~gary-lasker/software-center/display-cached-recommendations:
   - display cached recommendations in the lobby view in the case of
     no network access

Description of the change

A small branch that enables the display of cached recommendations in the lobby view when Ubuntu Software Center is started up and no network access is available.

To test:

1. Be opted in to the recommendations service.
2. Shut down Ubuntu Software Center.
3. Disable network access.
4. Restart Ubuntu Software Center and verify that recommendations are now displayed in the lobby view.

Many thanks!

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for this branch! It looks good, but there is on issue:

1. start with a fresh account (i.e. no ~/.cache/software-center, no ~/.config/software-center)
2. disable network
3. click on "opt-in"
4. close software-center
5. open software-center
Now there is a "Receiving recommendations..." spinner there that does not go away.

Revision history for this message
Michael Vogt (mvo) wrote :

The branch lp:~mvo/software-center/no-piston-data-means-error should fix the issue above, if that works for you as well, we should merge this. Note that I added lp:~mvo/software-center/rec-small-cleanup that also updates the TODO in _on_recommender_agent_error (among other things) to refelect that we use cached data now.

review: Approve
3089. By Gary Lasker

do the right thing for the case where there is no network and the user previously opted in to recommendations, but has not yet successfully completed the initial profile upload (and so no cache recommendations are yet available), many thanks mvo for catching this

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Hi Michael, thank you for your review and thanks especially for catching the issue you mentioned! Also, thank you for your branch to address it by having piston-mini-client return an error if there is no cached data available.

However, this approach has the unwanted side effect in Software Center where, if this error is received, the recommendations panel is inexplicably hidden completely.

I've made a fix in my branch to correctly handle this case before getting to the point of making the request to piston. Instead, I just check for the condition (user has opted-in but has not yet made a successful inital profile upload and recommendations download), and in that case I display the standard "Recommendations will appear when next online" message in the panel.

Regarding lp:~mvo/software-center/no-piston-data-means-error, I think it's still probably a good idea to return an error in the case of querying for data and none is available. It's not needed for this specific case any more, but it seems to me that it may very well be useful for the general case. Shall we still merge it?

Thanks very much!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/ui/gtk3/widgets/recommendations.py'
--- softwarecenter/ui/gtk3/widgets/recommendations.py 2012-07-26 20:12:28 +0000
+++ softwarecenter/ui/gtk3/widgets/recommendations.py 2012-08-15 14:28:24 +0000
@@ -160,7 +160,14 @@
160 if network_state_is_connected():160 if network_state_is_connected():
161 self._try_sso_login()161 self._try_sso_login()
162 else:162 else:
163 self._show_no_network_view()163 if self.recommender_agent.opt_in_requested:
164 # the user has opted in but has not yet completed the
165 # initial recommender profile upload, therefore there
166 # are no cached values available yet to display
167 self._show_no_network_view()
168 else:
169 # display cached recommendations
170 self._update_recommended_for_you_content()
164 else:171 else:
165 self._show_opt_in_view()172 self._show_opt_in_view()
166173

Subscribers

People subscribed via source and target branches