Skip to content

Commit eb946d7

Browse files
committed
fix: implement check to ensure correct user shows up in matchedUser field
1 parent 4c58547 commit eb946d7

File tree

1 file changed

+9
-1
lines changed
  • apps/frontend/src/app/question/[id]

1 file changed

+9
-1
lines changed

apps/frontend/src/app/question/[id]/page.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface Submission {
2121
submittedAt: string;
2222
language: string;
2323
matchedUser: string;
24+
otherUser: string;
2425
historyDocRefId: string;
2526
code: string;
2627
}
@@ -162,6 +163,7 @@ export default function QuestionPage() {
162163
language: data.language,
163164
matchedUser:
164165
username == data.matchedUser ? data.user : data.matchedUser,
166+
otherUser: data.user,
165167
historyDocRefId: data.historyDocRefId,
166168
code: data.code,
167169
});
@@ -279,7 +281,13 @@ export default function QuestionPage() {
279281
Language: {submission?.language || "-"}
280282
</div>
281283
<div className="submission-header-detail">
282-
Matched with: {submission?.matchedUser || "-"}
284+
Matched with:{" "}
285+
{submission?.matchedUser
286+
? // Check to ensure that matched user is correct, otherwise swap with otherUser
287+
username == submission.matchedUser
288+
? submission.otherUser
289+
: submission.matchedUser
290+
: "-"}
283291
</div>
284292
</div>
285293

0 commit comments

Comments
 (0)