From: root Date: Mon, 16 Dec 2013 03:34:38 +0000 Subject: additional overview stats X-Git-Url: http://maxious.lambdacomplex.org/git/?p=ckanext-dga-stats.git&a=commitdiff&h=b7b3043b725e370ecb8a8c4e6cc569811fb42280 --- additional overview stats --- --- a/ckanext/dga_stats/stats.py +++ b/ckanext/dga_stats/stats.py @@ -123,10 +123,12 @@ def summary_stats(cls): connection = model.Session.connection() -# select 'Total Archived Datasets', count(*) from package where (state='active' or state='draft' or state='draft-complete') and private = 't' union \ res = connection.execute("SELECT 'Total Organisations', count(*) from \"group\" where type = 'organization' and state = 'active' union \ select 'Total Datasets', count(*) from package where (state='active' or state='draft' or state='draft-complete') and private = 'f' union \ - select 'Total Data Files/Resources', count(*) from resource where state='active'").fetchall(); + select 'Total Archived Datasets', count(*) from package where (state='active' or state='draft' or state='draft-complete') and private = 't' union \ + select 'Total Data Files/Resources', count(*) from resource where state='active' union \ + select 'Total Machine Readable/Data API Resources', count(*) from resource where state='active' and webstore_url = 'active'\ + ").fetchall(); return res --- a/ckanext/dga_stats/templates/ckanext/stats/index.html +++ b/ckanext/dga_stats/templates/ckanext/stats/index.html @@ -6,31 +6,8 @@ {% block primary_content %}
-
-

{{ _('Summary') }}

- {% if c.summary_stats %} - - - - - - - - - {% for measure,value in c.summary_stats %} - - - - - {% endfor %} - -
{{ _('Measure') }}{{ _('Value') }}
{{measure}}{{ value }}
- {% else %} -

{{ _('No groups') }}

- {% endif %} -
{% if h.check_access('sysadmin') %} -
+

{{ _('Site Activity Log') }}

{% if c.activity_counts %} @@ -55,7 +32,7 @@

{{ _('No groups') }}

{% endif %} -
+

{{ _('Recent Datasets') }}

{% if c.recent_datasets %}
@@ -80,7 +57,7 @@

{{ _('No groups') }}

{% endif %} -
+

{{ _('User Access List') }}

{% if c.user_access_list %}
@@ -154,31 +131,6 @@
-
-

{{ _('Top Rated Datasets') }}

- {% if c.top_rated_packages %} - - - - - - - - - - {% for package, rating, num_ratings in c.top_rated_packages %} - - - - - - {% endfor %} - -
Dataset{{ _('Average rating') }}{{ _('Number of ratings') }}
{{ h.link_to(package.title or package.name, h.url_for(controller='package', action='read', id=package.name)) }}{{ rating }}{{ num_ratings }}
- {% else %} -

{{ _('No ratings') }}

- {% endif %} -

{{ _('Most Edited Datasets') }}

@@ -227,46 +179,6 @@

{{ _('No groups') }}

{% endif %}
-{% if False %} -
-

{{ _('Top Tags') }}

- - - - - - - - - {% for tag, num_packages in c.top_tags %} - - - - - {% endfor %} - -
{{ _('Tag Name') }}{{ _('Number of Datasets') }}
{{ h.link_to(tag.name, h.url_for(controller='package', action='search', tags=tag.name)) }}{{ num_packages }}
-
-
-

{{ _('Users Owning Most Datasets') }}

- - - - - - - - - {% for user, num_packages in c.top_package_owners %} - - - - - {% endfor %} - -
{{ _('User') }}{{ _('Number of Datasets') }}
{{ h.linked_user(user) }}{{ num_packages }}
-
-{% endif %}

{{ _('Datasets by Organization') }}

{% if c.by_org %} @@ -298,6 +210,31 @@

{{ _('No groups') }}

{% endif %}
+
+

{{ _('Summary') }}

+ {% if c.summary_stats %} + + + + + + + + + {% for measure,value in c.summary_stats %} + {% if 'Archived' not in measure or h.check_access('sysadmin') %} + + + + + {% endif %} + {% endfor %} + +
{{ _('Measure') }}{{ _('Value') }}
{{measure}}{{ value }}
+ {% else %} +

{{ _('No groups') }}

+ {% endif %} +
{% endblock %} @@ -306,19 +243,15 @@

{{ _('Statistics Menu') }}