diff --git a/src/app.py b/src/app.py index c9b2662e..334f8cf1 100644 --- a/src/app.py +++ b/src/app.py @@ -2241,7 +2241,8 @@ def get_summary_stats(self, start_date, end_date, group_by, folder=None): SUM((folders->'{folder}'->>'interactions_count')::numeric) as total_interactions_count, SUM((folders->'{folder}'->>'upload_size')::numeric) as total_upload_size, SUM((folders->'{folder}'->>'download_size')::numeric) as total_download_size, - JSONB_AGG((folders->'{folder}'->>'locations')::json) as total_locations + JSONB_AGG((folders->'{folder}'->>'locations')::json) as total_locations, + JSONB_AGG((summary->>'referrers')::json) as total_referrers FROM metrics WHERE @@ -2262,7 +2263,8 @@ def get_summary_stats(self, start_date, end_date, group_by, folder=None): SUM((summary->>'interactions_count')::numeric) as total_interactions_count, SUM((summary->>'upload_size')::numeric) as total_upload_size, SUM((summary->>'download_size')::numeric) as total_download_size, - JSONB_AGG((summary->>'locations')::json) as total_locations + JSONB_AGG((summary->>'locations')::json) as total_locations, + JSONB_AGG((summary->>'referrers')::json) as total_referrers FROM metrics WHERE @@ -2281,6 +2283,9 @@ def get_summary_stats(self, start_date, end_date, group_by, folder=None): item["total_locations"] = dict( sum((Counter(loc) for loc in item["total_locations"]), Counter()) ) + item["total_referrers"] = dict( + sum((Counter(loc) for loc in item["total_referrers"]), Counter()) + ) result_lists.append(dict(item)) return result_lists