Skip to content

Commit

Permalink
Fix: Update total count program for unboundedlikes
Browse files Browse the repository at this point in the history
  • Loading branch information
sora32127 committed Aug 31, 2024
1 parent db1afcd commit 4909b94
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/modules/db.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,17 @@ export async function getFeedComments(pagingNumber: number, type: FeedPostType,
}
}
if (type === "unboundedLikes"){
const totalCount = await prisma.dimComments.count();
const totalCountRaw = await prisma.$queryRaw`
with raw as (
select post_id, count(post_id) from fct_comment_vote_history
where vote_type = 1
group by post_id
having count(post_id) >= 1
)
select count(*) from raw;
` as { count: bigint }[]
const totalCount = Number(totalCountRaw[0].count);

const commentIds = await prisma.fctCommentVoteHistory.groupBy({
by: ["commentId"],
_count: { commentVoteId: true },
Expand Down

0 comments on commit 4909b94

Please sign in to comment.