From f7d2927ff15b26989fa92fe100cfa2d30c79097d Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Tue, 17 Dec 2024 23:13:49 +0100 Subject: [PATCH] fix(hotfixreferrers): added hot fix to added referrers --- src/app.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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