diff --git a/backend/collaboration-service/src/services/socketio.service.ts b/backend/collaboration-service/src/services/socketio.service.ts index fdd37d272b..325d462a26 100644 --- a/backend/collaboration-service/src/services/socketio.service.ts +++ b/backend/collaboration-service/src/services/socketio.service.ts @@ -45,8 +45,8 @@ export class WebSocketConnection { this.io.to(roomId).emit('executing-code') try { const dto: SubmissionResponseDto = await submitCode(data) - const { stdout, status, time } = dto - const response: IResponse = { stdout, status, time } + const { stdout, status, time, stderr, compile_output } = dto + const response: IResponse = { stdout, status, time, stderr, compile_output } this.io.to(roomId).emit('code-executed', response, data.expected_output) } catch (err) { this.io.to(roomId).emit('code-executed', { error: err }) diff --git a/frontend/components/customs/custom-tabs.tsx b/frontend/components/customs/custom-tabs.tsx index d88c4dba83..4214024334 100644 --- a/frontend/components/customs/custom-tabs.tsx +++ b/frontend/components/customs/custom-tabs.tsx @@ -29,7 +29,7 @@ export default function CustomTabs({ return (
{tabs.map((tab, index) => (
-
{matchData?.question.description}
+
{matchData?.question.description}
diff --git a/frontend/pages/code/test-result.tsx b/frontend/pages/code/test-result.tsx index d5f91f013c..3947aa5b78 100644 --- a/frontend/pages/code/test-result.tsx +++ b/frontend/pages/code/test-result.tsx @@ -2,23 +2,42 @@ import { IResponse } from '@repo/submission-types' export default function TestResult({ result, expectedOutput }: { result?: IResponse; expectedOutput: string }) { if (!result) return
No test results yet
- return ( -
-
+
+
{result.status?.id === 3 ? ( - Accepted + {result.status.description} ) : ( - Wrong Answer + {result.status.description} )}

Runtime: {result.time} ms

-
- Your Output = - {result.stdout ?? 'N/A'} - Expected output = - {expectedOutput} -
+ {result.status.id === 6 && result.compile_output && ( +
+ Error +

+ {result.compile_output} +

+
+ )} + {result.stderr && ( +
+ Error +

+ {result.stderr} +

+
+ )} + {(result.status.id === 3 || result.status.id == 4) && ( +
+ Your Output = + + {result.stdout ?? 'N/A'} + + Expected Output = + {expectedOutput} +
+ )}
) } diff --git a/frontend/pages/code/testcase-tab.tsx b/frontend/pages/code/testcase-tab.tsx index 8f1c3e61cc..0dd55f9d92 100644 --- a/frontend/pages/code/testcase-tab.tsx +++ b/frontend/pages/code/testcase-tab.tsx @@ -15,18 +15,18 @@ export default function TestcasesTab({ if (!testInputs || testInputs.length === 0) return null return ( -
+
-
+
Input = - {testInputs[activeTestcaseIdx]} + {testInputs[activeTestcaseIdx]} Expected output = - {testOutputs[activeTestcaseIdx]} + {testOutputs[activeTestcaseIdx]}
) diff --git a/packages/submission-types/src/IResponse.ts b/packages/submission-types/src/IResponse.ts index 6c8147a26c..6d2d2efc97 100644 --- a/packages/submission-types/src/IResponse.ts +++ b/packages/submission-types/src/IResponse.ts @@ -2,4 +2,6 @@ export interface IResponse { time: string | null status: { id: number; description: string } stdout: string | null + stderr: string | null + compile_output: string | null }