diff --git a/db/count-ano-user-activities.n1ql b/db/count-ano-user-activities.n1ql index 71f13ee..a01ca3f 100644 --- a/db/count-ano-user-activities.n1ql +++ b/db/count-ano-user-activities.n1ql @@ -1 +1,5 @@ -SELECT RAW COUNT(*) FROM `bucket_name` s WHERE s.type = "activity" AND activity.src = "web" AND activity.kind != "comment" +SELECT RAW COUNT(*) +FROM `bucket_name` s + WHERE s.type = "activity" + AND activity.src = "web" + AND activity.kind != "comment" diff --git a/db/count-user-activities.n1ql b/db/count-user-activities.n1ql index d632caf..1952938 100644 --- a/db/count-user-activities.n1ql +++ b/db/count-user-activities.n1ql @@ -5,13 +5,10 @@ WITH user_following AS ( s.`following` FROM `bucket_name` AS s - USE KEYS - $user + USE KEYS $user )[0]), activities AS ( - SELECT - activity.*, - d.username, + SELECT COUNT(*) AS activity_count FROM user_following AS d INNER JOIN `bucket_name` AS activity ON activity.username = d.username @@ -21,9 +18,5 @@ activities AS ( AND activity.kind != 'comment' ) -SELECT RAW COUNT(*) -FROM - activities AS activity - INNER JOIN `bucket_name` AS f ON activity.target = META(f).id -WHERE - f.`type` = 'file' +SELECT RAW activity_count +FROM activities;