def installs_series(request, addon, group, start, end, format): """Generate install counts grouped by ``group`` in ``format``.""" date_range = check_series_params_or_404(group, start, end, format) check_stats_permission(request, addon) series = get_series(Installed, addon=addon.id, date__range=date_range) if format == 'csv': return render_csv(request, addon, series, ['date', 'count']) elif format == 'json': return render_json(request, addon, series)
def overview_series(request, addon, group, start, end, format): """Combines installs_series and usage_series into one payload.""" date_range = check_series_params_or_404(group, start, end, format) check_stats_permission(request, addon) dls = get_series(DownloadCount, addon=addon.id, date__range=date_range) # Uncomment the line below to return fake stats. return fake_app_stats(request, addon, group, start, end, format) return render_json(request, addon, dls)
def usage_series(request, addon, group, start, end, format): date_range = check_series_params_or_404(group, start, end, format) check_stats_permission(request, addon) series = get_series(DownloadCount, addon=addon.id, date__range=date_range) # Uncomment the line below to return fake stats. return fake_app_stats(request, addon, group, start, end, format) if format == 'csv': return render_csv(request, addon, series, ['date', 'count']) elif format == 'json': return render_json(request, addon, series)