Skip to content

Commit

Permalink
fix: count user activities
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoubfaouzi committed Sep 29, 2024
1 parent 4f51c91 commit 303016f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 5 additions & 1 deletion db/count-ano-user-activities.n1ql
Original file line number Diff line number Diff line change
@@ -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"
15 changes: 4 additions & 11 deletions db/count-user-activities.n1ql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

0 comments on commit 303016f

Please sign in to comment.