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.
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.

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 on 2012-08-15

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

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
1=== modified file 'softwarecenter/ui/gtk3/widgets/recommendations.py'
2--- softwarecenter/ui/gtk3/widgets/recommendations.py 2012-07-26 20:12:28 +0000
3+++ softwarecenter/ui/gtk3/widgets/recommendations.py 2012-08-15 14:28:24 +0000
4@@ -160,7 +160,14 @@
5 if network_state_is_connected():
6 self._try_sso_login()
7 else:
8- self._show_no_network_view()
9+ if self.recommender_agent.opt_in_requested:
10+ # the user has opted in but has not yet completed the
11+ # initial recommender profile upload, therefore there
12+ # are no cached values available yet to display
13+ self._show_no_network_view()
14+ else:
15+ # display cached recommendations
16+ self._update_recommended_for_you_content()
17 else:
18 self._show_opt_in_view()
19

Subscribers

People subscribed via source and target branches