Skip to content

Commit

Permalink
Merge pull request #287 from hotosm/hotfix/referrers
Browse files Browse the repository at this point in the history
fix(hotfixreferrers): added hot fix to added referrers
  • Loading branch information
kshitijrajsharma authored Dec 17, 2024
2 parents a26ff0e + f7d2927 commit acd12da
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit acd12da

Please sign in to comment.