Merge lp:~gary-lasker/software-center/recommended-installed-feedback into lp:software-center
Status: | Merged |
---|---|
Merged at revision: | 3153 |
Proposed branch: | lp:~gary-lasker/software-center/recommended-installed-feedback |
Merge into: | lp:software-center |
Prerequisite: | lp:~gary-lasker/software-center/update-to-latest-recommender-client |
Diff against target: |
942 lines (+356/-133) 11 files modified
softwarecenter/backend/piston/sreclient_pristine.py (+1/-1) softwarecenter/backend/recagent.py (+26/-1) softwarecenter/enums.py (+4/-0) softwarecenter/ui/gtk3/panes/availablepane.py (+3/-10) softwarecenter/ui/gtk3/views/appdetailsview.py (+7/-7) softwarecenter/ui/gtk3/views/catview_gtk.py (+59/-39) softwarecenter/ui/gtk3/widgets/containers.py (+41/-17) softwarecenter/ui/gtk3/widgets/recommendations.py (+79/-29) tests/gtk3/test_catview.py (+117/-21) tests/gtk3/windows.py (+9/-8) tests/test_recagent.py (+10/-0) |
To merge this branch: | bzr merge lp:~gary-lasker/software-center/recommended-installed-feedback |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Vogt | 2012-08-30 | Approve on 2012-09-06 | |
Review via email:
|
This proposal supersedes a proposal from 2012-08-28.
Commit message
* lp:~gary-lasker/software-center/recommended-installed-feedback:
- signal the recommender service when a recommended item has been
successfully installed, refactor and clean up surrounding code,
new unit tests for the feature (LP: #944060, LP: #1044107)
Description of the change
This branch implements the "implicit" recommender feedback feature. It detects the case where the user successfully installs a recommended item and fires a "submit_
This is the client-side implementation for bug 944060.
Note that this branch depends on the lp:~gary-lasker/software-center/update-to-latest-recommender-client branch as that branch adds the new recommender client code from lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-recommender-client. Also note that I made one small change to sreclient to fix the validate decorator for the pkgname argument to implicit_feedback so that it matches the validator for the other calls that use pkgname as an argument.
Finally, I added a unit test for the new call in test_recagent.py, however like a few of the other tests there, the test is not currently working with the server. Therefore, it remains disabled as the other tests are. I'll look at this tomorrow to try to see what the issue is with these tests.
Meanwhile, everything here should be working. To test, just select any recommended item in the lobby or category views and install it. Once the installation is complete, the corresponding implicit_feedback call will be fired.
Many thanks for your review!
Michael Vogt (mvo) wrote : | # |
Gary Lasker (gary-lasker) wrote : | # |
Just a note that I have a branch for review with the recommender-client changes that I mentioned above (and that have been made to sreclient_
Gary Lasker (gary-lasker) wrote : | # |
> On Tue, Aug 28, 2012 at 05:46:23AM -0000, Gary Lasker wrote:
> > Gary Lasker has proposed merging lp:~gary-lasker/software-center
> /recommended-
> /software-
>
> Thanks for working on this branch. I'm very happy to see this feature
> coming.
>
> [..]
> > Note that this branch depends on the lp:~gary-lasker/software-center/update-
> to-latest-
> client code from lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-
> recommender-client. Also note that I made one small change to sreclient to fix
> the validate decorator for the pkgname argument to implicit_feedback so that
> it matches the validator for the other calls that use pkgname as an argument.
>
> Thanks for this, if you fixed the sreclient_
> send the diff to the server team (if you haven't done already) so that
> they add it to their
> lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-recommender-client
> branch.
Yep, I proposed a branch for this and it has been merged by Lukasz.
>
> > Finally, I added a unit test for the new call in test_recagent.py, however
> like a few of the other tests there, the test is not currently working with
> the server. Therefore, it remains disabled as the other tests are. I'll look
> at this tomorrow to try to see what the issue is with these tests.
> [..]
>
> Maybe the staging server had problems. I just tested enabling them and
> its working, but that may well be that its now fixed. While looking at
> the test code I noticed that there is a bit of duplication in
> there, I pushed a branch at
> lp:~mvo/software-center/recagent-test-cleanup that removes most of
> that.
>
> I also noticed that the branch is missing a test for the new
> functionality, it would be nice to add one to
> tests/gtk3/
> app, trigger a install transaction and verify that on finish the
> self.recommende
>
I added a thorough test for this functionality in test_catview.py (this is where the other recommendations panel tests are, and imo it's consistent because the tests for the other lobby panels (What's New and Top Rated) are also located here. While in test_catview.py I did some cleanup and consolidation of duplicated code as well.
> > @@ -244,7 +262,7 @@
> >
> > def _on_submit_
> > piston_
> > - self.emit(
> > + self.emit(
> piston_
>
> Nice that this is more consistent now (plus that it will actually work).
>
> > === modified file 'softwarecenter
> > --- softwarecenter/
> > +++ softwarecenter/
> > @@ -299,6 +299,9 @@
> > LOBBY_RECOMMEND
> > DETAILS_
> >
> > +# action values for recommendations implicit f...
Gary Lasker (gary-lasker) wrote : | # |
Oops, I noticed a typo in my last comment:
"...when a person clicks on a recommended item, we remember that they did that for that item for as long as the current USC session is active (it is now, however, persisted between sessions, I think would be a mistake)."
Should be (see the "*not*"):
"...when a person clicks on a recommended item, we remember that they did that for that item for as long as the current USC session is active (it is *not*, however, persisted between sessions, I think would be a mistake)."
Though maybe this was obvious, but I wanted to make sure that I'm clear.
Thanks again!
Gary Lasker (gary-lasker) wrote : | # |
What the heck? Guess I won't "resubmit" a MP again. :/
Michael Vogt (mvo) wrote : | # |
On Thu, Aug 30, 2012 at 09:25:21PM -0000, Gary Lasker wrote:
> > On Tue, Aug 28, 2012 at 05:46:23AM -0000, Gary Lasker wrote:
> > > Gary Lasker has proposed merging lp:~gary-lasker/software-center
> > /recommended-
> > /software-
> >
> > Thanks for working on this branch. I'm very happy to see this feature
> > coming.
> >
> > [..]
> > > Note that this branch depends on the lp:~gary-lasker/software-center/update-
> > to-latest-
> > client code from lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-
> > recommender-client. Also note that I made one small change to sreclient to fix
> > the validate decorator for the pkgname argument to implicit_feedback so that
> > it matches the validator for the other calls that use pkgname as an argument.
> >
> > Thanks for this, if you fixed the sreclient_
> > send the diff to the server team (if you haven't done already) so that
> > they add it to their
> > lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-recommender-client
> > branch.
>
> Yep, I proposed a branch for this and it has been merged by Lukasz.
Great, thanks for this.
> > > Finally, I added a unit test for the new call in test_recagent.py, however
> > like a few of the other tests there, the test is not currently working with
> > the server. Therefore, it remains disabled as the other tests are. I'll look
> > at this tomorrow to try to see what the issue is with these tests.
> > [..]
> >
> > Maybe the staging server had problems. I just tested enabling them and
> > its working, but that may well be that its now fixed. While looking at
> > the test code I noticed that there is a bit of duplication in
> > there, I pushed a branch at
> > lp:~mvo/software-center/recagent-test-cleanup that removes most of
> > that.
> >
> > I also noticed that the branch is missing a test for the new
> > functionality, it would be nice to add one to
> > tests/gtk3/
> > app, trigger a install transaction and verify that on finish the
> > self.recommende
> >
>
> I added a thorough test for this functionality in test_catview.py (this is where the other recommendations panel tests are, and imo it's consistent because the tests for the other lobby panels (What's New and Top Rated) are also located here. While in test_catview.py I did some cleanup and consolidation of duplicated code as well.
Thanks for adding the test and for the cleanup there, that looks very
good!
[..]
> > Should self.recommende
> > e.g on _on_app_
> > function for the categories). Or should this be persistent? I'm don't
> > know the details of the spec well enough :) I guess it comes down to
> > if we should consider it a recommendation that are reached
> > "indirectly", e.g. click on it "app A", move back to main view search
> > for something else and then reach "app A" again late...
- 3094. By Gary Lasker on 2012-08-31
-
add a test to insure that no recommender feedback call occurs in the case where the user is *not* opted in to the recommender service
- 3095. By Gary Lasker on 2012-08-31
-
merge with trunk
- 3096. By Gary Lasker on 2012-09-02
-
RED: add a failing test to show that the implicit recommender call is incorrectly being made from the top rated panel
- 3097. By Gary Lasker on 2012-09-03
-
the fix for the failing test case is to do the refactoring that we know is needed in CategoriesViewGtk to move the add_tiles_
to_flowgrid and corresponding on_application_ selected methods to where they belong, specifically, to the FlowableGrid class itself, this commit contains the brunt of this refactor, but there are some additional pieces needed to finish it up - 3098. By Gary Lasker on 2012-09-04
-
GREEN: essential refactor complete and signals wired up, all test cases now working; removed the unused (with FIXME) 'application-
selected' signal from catview as it is not used there (we only 'activate' apps from this widget), fix single-line cut-and-paste error in the test case - 3099. By Gary Lasker on 2012-09-05
-
REFACTOR: make a new TileGrid subclass of FlowableGrid so that FlowableGrid remains generic, wire up the TileGrid for the various panels that it is used
- 3100. By Gary Lasker on 2012-09-05
-
REFACTOR: remove all need for the catview in the recommendations code
- 3101. By Gary Lasker on 2012-09-05
-
don't use hasattr in the FramedHeaderBox so that we can attach listeners to the more button when we need to, connect listeners for this, add a signal to the RecommenderPane
lCategory (and subclass RecommenderPane lLobby) so that we can get their correct categories when clicking 'More' in those - 3102. By Gary Lasker on 2012-09-05
-
pep8 fixes
- 3103. By Gary Lasker on 2012-09-05
-
merge with trunk
- 3104. By Gary Lasker on 2012-09-05
-
clean up get_test_
window_ recommendations in windows.py per the new factoring
Gary Lasker (gary-lasker) wrote : | # |
Ok, I've added more unit test cases, done a lot of refactoring and cleanup around this area of the code (lots of FIXMEs cleared) and at this point the branch should be ready for review again. You can review the changes in detail by looking at the checkin comments starting at rev 3094.
Many thanks for your review, as always!!
Michael Vogt (mvo) wrote : | # |
Hi Gary, thanks for this updated branch.
I just reviewed it and it looks very nice now. Some comments below:
I like that the recommendations widgets do no longer get a catview, giving them the db and propertieshelper
looks much nicer now.
395 class FlowableGrid(
396
397 MIN_HEIGHT = 100
398
399 + __gsignals__ = {
400 + "application-
401 + None,
402 + (GObject.
403 + ),
404 + }
405 +
It seems that the FlowableGrid is pretty generic (i.e. can hold other items than application tiles too) so this signal probably is better put into the TileGrid class? Or am I missing something here? I can do this during the merge if you agree with moving it.
I think its great that you added the docstring:
416 + def add_tiles(self, properties_helper, docs, amount):
417 + '''Adds application tiles to an ApplicationTile
418 + properties_help = an instance of the PropertiesHelper object
419 + docs = xapian documents (apps)
420 + amount = number of tiles to add from start of doc range'''
here! It might be worth taking a quick look http://
I like the way the "more" button is now handled, much nicer than in the previous code.
Gary Lasker (gary-lasker) wrote : | # |
> Hi Gary, thanks for this updated branch.
>
> I just reviewed it and it looks very nice now. Some comments below:
>
>
> I like that the recommendations widgets do no longer get a catview, giving
> them the db and propertieshelper
> looks much nicer now.
>
> 395 class FlowableGrid(
> 396
> 397 MIN_HEIGHT = 100
> 398
> 399 + __gsignals__ = {
> 400 + "application-
> 401 + None,
> 402 + (GObject.
> 403 + ),
> 404 + }
> 405 +
>
> It seems that the FlowableGrid is pretty generic (i.e. can hold other items
> than application tiles too) so this signal probably is better put into the
> TileGrid class? Or am I missing something here? I can do this during the merge
> if you agree with moving it.
Yes! Thank you for noticing that. I just overlooked moving it down to the new subclass, but you are correct, that's where it belongs.
>
> I think its great that you added the docstring:
> 416 + def add_tiles(self, properties_helper, docs, amount):
> 417 + '''Adds application tiles to an ApplicationTile
> 418 + properties_help = an instance of the PropertiesHelper object
> 419 + docs = xapian documents (apps)
> 420 + amount = number of tiles to add from start of doc range'''
> here! It might be worth taking a quick look
> http://
> convention that everyone in the python community is following, so to a good
> extend its a matter of taste :) I personally like using a "--" as the keyword
> seperator there, e.g. "doc -- xapian docuemnts" better than using the "=" as
> initially my brain read it as code until I noticed the surrounding '''. But
> thats just a tiny detail and its good to have the docstring.
>
I am with you completely. I just cut and pasted from another docstring and didn't notice the "=" signs. I would much prefer something different, and "--" seems just fine to me.
> I like the way the "more" button is now handled, much nicer than in the
> previous code.
Thanks! I like all of this better too. :) I'll make the updates now.
- 3105. By Gary Lasker on 2012-09-06
-
move the application-
activated signal into the TileGrid subclass where it belongs - 3106. By Gary Lasker on 2012-09-06
-
make a docstring more better per review comment
Gary Lasker (gary-lasker) wrote : | # |
Remaining small updates are done in the branch, now we just need the FFe! Bug 1044107. Hopefully very soon now.
- 3107. By Gary Lasker on 2012-09-06
-
merge with trunk, don't wanna cruft
On Tue, Aug 28, 2012 at 05:46:23AM -0000, Gary Lasker wrote:
> Gary Lasker has proposed merging lp:~gary-lasker/software-center/recommended-installed-feedback into lp:software-center with lp:~gary-lasker/software-center/update-to-latest-recommender-client as a prerequisite.
Thanks for working on this branch. I'm very happy to see this feature
coming.
[..]
> Note that this branch depends on the lp:~gary-lasker/software-center/update-to-latest-recommender-client branch as that branch adds the new recommender client code from lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-recommender-client. Also note that I made one small change to sreclient to fix the validate decorator for the pkgname argument to implicit_feedback so that it matches the validator for the other calls that use pkgname as an argument.
Thanks for this, if you fixed the sreclient_ pristine. py, please also
send the diff to the server team (if you haven't done already) so that
they add it to their
lp:~canonical-ca-hackers/ubuntu-recommender/ubuntu-recommender-client
branch.
> Finally, I added a unit test for the new call in test_recagent.py, however like a few of the other tests there, the test is not currently working with the server. Therefore, it remains disabled as the other tests are. I'll look at this tomorrow to try to see what the issue is with these tests.
[..]
Maybe the staging server had problems. I just tested enabling them and
its working, but that may well be that its now fixed. While looking at
the test code I noticed that there is a bit of duplication in
there, I pushed a branch at
lp:~mvo/software-center/recagent-test-cleanup that removes most of
that.
I also noticed that the branch is missing a test for the new test_recommenda tions_widget. py. Something like activate a r_agent. post_implicit_ feedback( ) call was done.
functionality, it would be nice to add one to
tests/gtk3/
app, trigger a install transaction and verify that on finish the
self.recommende
> @@ -244,7 +262,7 @@ anon_profile_ data(self, spawner, submit_ anon_profile) : "submit- anon_profile" , piston_ submit_ anon_profile) "submit- anon-profile- finished" , piston_ submit_ anon_profile)
>
> def _on_submit_
> piston_
> - self.emit(
> + self.emit(
Nice that this is more consistent now (plus that it will actually work).
> === modified file 'softwarecenter /enums. py' enums.py 2012-08-23 14:37:28 +0000 enums.py 2012-08-28 05:45:23 +0000 ATIONS_ CAROUSEL_ LIMIT = 9 RECOMMENDATIONS _CAROUSEL_ LIMIT = 4 S_FEEDBACK_ INSTALLED = "installed"
> --- softwarecenter/
> +++ softwarecenter/
> @@ -299,6 +299,9 @@
> LOBBY_RECOMMEND
> DETAILS_
>
> +# action values for recommendations implicit feedback
> +RECOMMENDATION
> +
That looks like we could use:
class RecommenderFeed back:
INSTALLED = "installed"
(so that later "REMOVED" can be added there as well and its more
consitent with the rest of enums.py).
[..] _activated( self, catview, app): "application- activated" , app) r_agent. i...
> def _on_application
> self.emit(
> + # we only track installed items of the user has opted-in to the
> + # recommendations service
> + if self.recommende