Skip to content

Commit 9f848f8

Browse files
authored
Merge pull request #66 from CS3219-AY2425S1/bug/match-logic
bug/match-logic: Fix matching clause bug
2 parents 1f95c75 + 38c0141 commit 9f848f8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backend/matching/src/workers/matcher.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async function match() {
133133
sendNotif([requestorSocketPort], MATCHING_EVENT.MATCHING);
134134
await redisClient.hSet(getPoolKey(requestorUserId), 'pending', 'false');
135135

136-
const clause = [`-@userId:(${requestorUserId}) @pending:(true)`];
136+
let clause = [`-@userId:(${requestorUserId})`, '@pending:(true)'];
137137

138138
if (difficulty) {
139139
clause.push(`@difficulty:{${difficulty}}`);
@@ -143,6 +143,9 @@ async function match() {
143143
clause.push(`@topic:{${topic}}`);
144144
}
145145

146+
// Push UserID clause to the back.
147+
clause = clause.reverse();
148+
146149
const searchParams = {
147150
LIMIT: { from: 0, size: 1 },
148151
SORTBY: { BY: 'timestamp', DIRECTION: 'ASC' },

0 commit comments

Comments
 (0)