Skip to content

Commit

Permalink
fix(leaderboard): try to fix score
Browse files Browse the repository at this point in the history
  • Loading branch information
tfkhdyt committed Jul 7, 2024
1 parent c818af5 commit e12b9c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/api/routers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const userRouter = createTRPCRouter({
),
findMostActiveUsers: publicProcedure.query(async ({ ctx }) => {
const score =
sql`COUNT(DISTINCT ${questions.id}) * 2 + COUNT(DISTINCT ${answers.id}) * 3 + COUNT(DISTINCT ${favorites.questionId})`.mapWith(
sql`COUNT(DISTINCT ${questions.id}) * 2 + COUNT(DISTINCT ${answers.id}) * 3 + COUNT(DISTINCT ${favorites.questionId}) * 1`.mapWith(
Number,
);

Expand Down
2 changes: 1 addition & 1 deletion src/server/repositories/postgres/question-repo-pg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class QuestionRepoPg {

async findMostPopularQuestion(subjectId?: string) {
const popularity =
sql`COUNT(DISTINCT ${favorites.userId}) + COUNT(DISTINCT ${answers.id}) * 2`.mapWith(
sql`COUNT(DISTINCT ${favorites.userId}) * 1 + COUNT(DISTINCT ${answers.id}) * 2`.mapWith(
Number,
);

Expand Down

0 comments on commit e12b9c8

Please sign in to comment.