Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: count user activities #91

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading