remove top_tags stats for DB load
--- a/ckanext/dga_stats/controller.py
+++ b/ckanext/dga_stats/controller.py
@@ -12,7 +12,6 @@
c.top_rated_packages = stats.top_rated_packages()
c.most_edited_packages = stats.most_edited_packages()
c.largest_groups = stats.largest_groups()
- c.top_tags = stats.top_tags()
c.top_package_owners = stats.top_package_owners()
c.summary_stats = stats.summary_stats()
c.activity_counts = stats.activity_counts()
--- a/ckanext/dga_stats/stats.py
+++ b/ckanext/dga_stats/stats.py
@@ -116,32 +116,6 @@
order by count(*) desc;").fetchall();
res_groups = [(model.Session.query(model.Group).get(unicode(group_id)), val) for group_id, val in res]
return res_groups
-
- @classmethod
- def top_tags(cls, limit=10, returned_tag_info='object'): # by package
- assert returned_tag_info in ('name', 'id', 'object')
- tag = table('tag')
- package_tag = table('package_tag')
- package = table('package')
- #TODO filter out tags with state=deleted
- if returned_tag_info == 'name':
- from_obj = [package_tag.join(tag)]
- tag_column = tag.c.name
- else:
- from_obj = None
- tag_column = package_tag.c.tag_id
- s = select([tag_column, func.count(package_tag.c.package_id)],
- from_obj=from_obj)
- s = s.group_by(tag_column).\
- where(package.c.private == 'f').\
- order_by(func.count(package_tag.c.package_id).desc()).\
- limit(limit)
- res_col = model.Session.execute(s).fetchall()
- if returned_tag_info in ('id', 'name'):
- return res_col
- elif returned_tag_info == 'object':
- res_tags = [(model.Session.query(model.Tag).get(unicode(tag_id)), val) for tag_id, val in res_col]
- return res_tags
@classmethod
def top_package_owners(cls, limit=10):