From: David Read Date: Fri, 19 Apr 2013 19:06:52 +0000 Subject: Merge branch 'stable' of github.com:datagovuk/ckanext-ga-report X-Git-Url: http://maxious.lambdacomplex.org/git/?p=ckanext-ga-report.git&a=commitdiff&h=e9fa3effd2a57e94d99130e37d4b92595f60400b --- Merge branch 'stable' of github.com:datagovuk/ckanext-ga-report --- --- a/ckanext/ga_report/controller.py +++ b/ckanext/ga_report/controller.py @@ -218,7 +218,10 @@ 'x':_get_unix_epoch(stat.period_name), 'y':float(stat.value) }) - graph = [ graph_dict[x[0]] for x in entries ] + stats_in_table = [x[0] for x in entries] + stats_not_in_table = set(graph_dict.keys()) - set(stats_in_table) + stats = stats_in_table + sorted(list(stats_not_in_table)) + graph = [graph_dict[x] for x in stats] setattr(c, v+'_graph', json.dumps( _to_rickshaw(graph,percentageMode=True) )) # Get the total for each set of values and then set the value as @@ -445,12 +448,13 @@ fraction = float(point['y']) / totals[point['x']] if not (series in data) and fraction>THRESHOLD: data.append(series) - # Overwrite data with a set of intereting series + # Overwrite data with a set of interesting series others = [ x for x in raw_data if not (x in data) ] - data.append({ - 'name':'Other', - 'data': [ {'x':x,'y':y} for x,y in get_totals(others).items() ] - }) + if len(others): + data.append({ + 'name':'Other', + 'data': [ {'x':x,'y':y} for x,y in get_totals(others).items() ] + }) # Turn each point into a percentage for series in data: for point in series['data']: --- a/ckanext/ga_report/helpers.py +++ b/ckanext/ga_report/helpers.py @@ -80,7 +80,7 @@ return base.render_snippet('ga_report/ga_popular_single.html', **context) -def most_popular_datasets(publisher, count=20): +def most_popular_datasets(publisher, count=20, preview_image=None): if not publisher: _log.error("No valid publisher passed to 'most_popular_datasets'") @@ -92,7 +92,8 @@ 'dataset_count': len(results), 'datasets': results, - 'publisher': publisher + 'publisher': publisher, + 'preview_image': preview_image } return base.render_snippet('ga_report/publisher/popular.html', **ctx) --- a/ckanext/ga_report/templates/ga_report/ga_util.html +++ b/ckanext/ga_report/templates/ga_report/ga_util.html @@ -81,7 +81,7 @@

Graph Legend

-
(No graph loaded)
+
--- a/ckanext/ga_report/templates/ga_report/publisher/index.html +++ b/ckanext/ga_report/templates/ga_report/publisher/index.html @@ -6,8 +6,6 @@ Usage by Publisher - - --- a/ckanext/ga_report/templates/ga_report/publisher/popular.html +++ b/ckanext/ga_report/templates/ga_report/publisher/popular.html @@ -15,7 +15,12 @@ -

${h.link_to("More usage data for " + publisher.title, h.url_for(controller='ckanext.ga_report.controller:GaDatasetReport',action='read_publisher',id=publisher.name))}

+

+ +
+ More usage data for ${publisher.title} +
+

--- a/ckanext/ga_report/templates/ga_report/publisher/read.html +++ b/ckanext/ga_report/templates/ga_report/publisher/read.html @@ -6,8 +6,6 @@ Usage by Dataset - - --- a/ckanext/ga_report/templates/ga_report/site/downloads.html +++ b/ckanext/ga_report/templates/ga_report/site/downloads.html @@ -6,8 +6,6 @@ Downloads - - ${ga_sidebar(download_link=h.url_for(controller='ckanext.ga_report.controller:GaReport',action='csv_downloads',month=c.month or 'all'))} --- a/ckanext/ga_report/templates/ga_report/site/index.html +++ b/ckanext/ga_report/templates/ga_report/site/index.html @@ -6,8 +6,6 @@ Site usage - -