Skip to content

Commit

Permalink
potential fix for vote count issues
Browse files Browse the repository at this point in the history
  • Loading branch information
omranjamal committed Aug 17, 2024
1 parent e4e1ba9 commit db87788
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ export const listPetitions = publicProcedure
)
.select(['petitions.id'])
.select(({fn}) => [
fn
.count('upvotes.id')
.as('petition_upvote_count'),
fn.countAll().as('petition_upvote_count'),
]),
).let((query) => {
if (input.filter === 'request') {
Expand Down Expand Up @@ -109,7 +107,7 @@ export const listPetitions = publicProcedure
)
.selectAll('results')
.select(({fn}) => [
fn.count('downvotes.id').as('petition_downvote_count'),
fn.countAll().as('petition_downvote_count'),
])
.groupBy(['results.id', 'results.petition_upvote_count']);
})
Expand Down

0 comments on commit db87788

Please sign in to comment.