Merge lp:~sinzui/charmworld/api3-interesting into lp:~juju-jitsu/charmworld/trunk
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | 370 |
Merged at revision: | 366 |
Proposed branch: | lp:~sinzui/charmworld/api3-interesting |
Merge into: | lp:~juju-jitsu/charmworld/trunk |
Diff against target: |
111 lines (+50/-6) 2 files modified
charmworld/views/api.py (+7/-6) charmworld/views/tests/test_api.py (+43/-0) |
To merge this branch: | bzr merge lp:~sinzui/charmworld/api3-interesting |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | Approve | ||
Review via email: mp+181910@code.launchpad.net |
Commit message
Update interesting to support bundles.
Description of the change
Update interesting to support bundles.
RULES
Pre-
* Change the calls in _interesting_
* Update API2 to always pass CHARMS.
* Update API3 to pass None (to get both CHARMS and BUNDLES)
FUTURE
* Add date_created to bundles?
* Add downloads to bundles?
* Update get_featured to work with the charms and bundles collections
possibly by extending http://
QA
* Visit http://
* Verify all four checks pass.
* Visit http://
* Verify list contains charms.
* Visit http://
* Verify the data contains a lists of new, popular and featured
charms. The wiki bundle wont appear because it has no downloads
nor is it new.
IMPLEMENTATION
I cut the scope of this branch when I realised other parts of the code
need to change to truly show bundles with charms in production. This
branch does allow API to include bundles in new, popular, and featured,
but there are underlying data issues that prevent bundles from appearing.
The tests are simplified versions of other "interesting" tests that
checks the specific rules of the content of new, popular, and featured.
These tests only verify that API3 includes bundles and charms while
preserving the charm-only rule of API2.
While the tests show that bundles are supported, they wont be in
production! Bundles don't have a date_created attr so they are ranked
last. They appear in test because there are only two things in the db.
Similarly, bundles don't have a downloads attr, they are ranked last and
appear because there are only two things in the test. Following the
example of charms, we can use the branch's date_created as the bundle's
date_created. We need to count bundle json requests and store them in a
downloads attr to collect popular data. Bundles can be featured (as
demonstrated by the test setup) but we cannot see them in results.
I tried to solve including featured bundles. I got stuck when I realised
that get_featured() takes the charms collection as an argument. I suspect
we want to pass both the charms and bundle collections to get the right
data, but I don't know ho we want to merge the two lists? bundles first,
charms first, or intermingle them based on some attr? This is the diff
if what I attempted to allow me to locate featured charms and bundles.
http://
I have some additional thoughts about getting featured charms and bundles. The current implementation is a mongo collection find, but all other API search methods use elasticsearch. The current implementation uses the featured data to create a find spec. We could instead use the featured data to create a list of ids to pass the index_clients muiltget() function. We would get charms and bundles from ES as we do for new and popular.