From a674be724f651905df36e56e20f8f07fd7dfb20c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20K=C3=B6gl?= Date: Tue, 15 Jul 2014 10:24:24 +0200 Subject: [PATCH] [Migration] remove unused method all_tags() This makes the view podcasts/by_tag redundant, which is also removed. --- .../general/_design/podcasts/views/by_tag/map.js | 42 ---------------------- .../_design/podcasts/views/by_tag/reduce.js | 1 - doc/dev/couchdb-views.rst | 10 ------ mygpo/db/couchdb/directory.py | 27 -------------- 4 files changed, 80 deletions(-) delete mode 100644 couchdb/general/_design/podcasts/views/by_tag/map.js delete mode 100644 couchdb/general/_design/podcasts/views/by_tag/reduce.js diff --git a/couchdb/general/_design/podcasts/views/by_tag/map.js b/couchdb/general/_design/podcasts/views/by_tag/map.js deleted file mode 100644 index 84816213..00000000 --- a/couchdb/general/_design/podcasts/views/by_tag/map.js +++ /dev/null @@ -1,42 +0,0 @@ -function(doc) -{ - function searchPodcast(podcast, podcast_id) - { - for(var source in podcast.tags) - { - for(var n in podcast.tags[source]) - { - emit([podcast.tags[source][n], podcast_id], sourceWeight(source)); - } - } - } - - function sourceWeight(source) - { - if(source == "feed") - { - return 1; - } - else if (source == "delicious") - { - return 2; - } - else - { - return 0; - } - } - - if(doc.doc_type == "Podcast") - { - searchPodcast(doc, doc._id); - } - else if(doc.doc_type == "PodcastGroup") - { - for(var n in doc.podcasts) - { - var podcast = doc.podcasts[n]; - searchPodcast(podcast, podcast.id); - } - } -} diff --git a/couchdb/general/_design/podcasts/views/by_tag/reduce.js b/couchdb/general/_design/podcasts/views/by_tag/reduce.js deleted file mode 100644 index a1050627..00000000 --- a/couchdb/general/_design/podcasts/views/by_tag/reduce.js +++ /dev/null @@ -1 +0,0 @@ -_sum diff --git a/doc/dev/couchdb-views.rst b/doc/dev/couchdb-views.rst index 082a35bd..aab59b64 100644 --- a/doc/dev/couchdb-views.rst +++ b/doc/dev/couchdb-views.rst @@ -37,16 +37,6 @@ Doc-Types: PodcastList * `podcastlists/random `_ -Podcasts -^^^^^^^^ - -Doc-Types: Podcast, PodcastGroup, PodcastSubscriberData - -**Views** - -* `podcasts/by_tag `_ - - Suggestions ^^^^^^^^^^^ diff --git a/mygpo/db/couchdb/directory.py b/mygpo/db/couchdb/directory.py index 7e73172a..49de1270 100644 --- a/mygpo/db/couchdb/directory.py +++ b/mygpo/db/couchdb/directory.py @@ -131,33 +131,6 @@ def tags_for_user(user, podcast_id=None): return tags -def all_tags(): - """ Returns all tags - - Some tags might be returned twice """ - db = get_main_database() - res = multi_request_view(db, 'podcasts/by_tag', - wrap = False, - reduce = True, - group = True, - group_level = 1 - ) - - for r in res: - yield r['key'][0] - - udb = get_userdata_database() - res = multi_request_view(udb, 'usertags/podcasts', - wrap = False, - reduce = True, - group = True, - group_level = 1 - ) - - for r in res: - yield r['key'][0] - - @cache_result(timeout=60*60) def toplist(res_cls, view, key, limit, **view_args): -- 2.11.4.GIT