Skip to content

Commit 97f8c31

Browse files
authored
Merge pull request #54 from CS3219-AY2425S1/bug/user-service-attempted-qn
Fix bug in get attempted qns EP
2 parents b3019c7 + 66d756a commit 97f8c31

File tree

1 file changed

+2
-2
lines changed
  • backend/user/src/services/questions

1 file changed

+2
-2
lines changed

backend/user/src/services/questions/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const addAttemptedQuestionService = async (
2525
const userRecords = await db
2626
.select({ id: users.id, attemptedQuestions: users.attemptedQuestions })
2727
.from(users)
28-
.where(sql`${users.username} = ANY(${userIds})`);
28+
.where(sql`${users.id} = ANY(${userIds})`);
2929

3030
if (userRecords.length === 0) {
3131
return {
@@ -72,7 +72,7 @@ export const getAttemptedQuestionsService = async (
7272
const result = await db
7373
.select({ attemptedQuestions: users.attemptedQuestions })
7474
.from(users)
75-
.where(eq(users.username, userId))
75+
.where(eq(users.id, userId))
7676
.limit(1);
7777

7878
if (result.length === 0) {

0 commit comments

Comments
 (0)