Changes to tidy up the handling of all months;
[ckanext-ga-report.git] / ckanext / ga_report / controller.py
blob:a/ckanext/ga_report/controller.py -> blob:b/ckanext/ga_report/controller.py
--- a/ckanext/ga_report/controller.py
+++ b/ckanext/ga_report/controller.py
@@ -22,6 +22,7 @@
 
 
 def _month_details(cls):
+    '''Returns a list of all the month names'''
     months = []
     vals = model.Session.query(cls.period_name).filter(cls.period_name!='All').distinct().all()
     for m in vals:
@@ -308,6 +309,8 @@
         select department_id, sum(pageviews::int) views, sum(visitors::int) visits
         from ga_url
         where department_id <> ''
+          and package_id <> ''
+          and url like '/dataset/%%'
           and period_name=%s
         group by department_id order by visits desc
         """