@@ -10,10 +10,12 @@ export interface JudgeSubmissionRequestBody {
1010
1111export interface JudgeResultRequestBody {
1212 stdout : string ;
13- status_id : number ;
1413 language_id : number ;
1514 stderr : string ;
16- status : object ;
15+ status : {
16+ id : number ;
17+ description : string ;
18+ } ;
1719 token : string ;
1820}
1921
@@ -35,7 +37,6 @@ class Judge0Connector {
3537 if ( ! body || body . length === 0 ) {
3638 throw new BadRequestException ( 'At least one submission is required' ) ;
3739 }
38-
3940 const url = `${ process . env . JUDGE_URL } /submissions/batch?fields=${ this . fields . join ( ',' ) } ` ;
4041 const requestBody = { submissions : [ ...body ] } ;
4142 const response = await fetch ( url , {
@@ -71,7 +72,10 @@ class Judge0Connector {
7172 throw new InternalServerException ( `Judge0 API error: ${ jsonResponse . error } ` ) ;
7273 }
7374
74- return jsonResponse ;
75+ if ( ! ( 'submissions' in jsonResponse ) ) {
76+ throw new InternalServerException ( `Submissions Not Returned` ) ;
77+ }
78+ return jsonResponse [ 'submissions' ] ;
7579 }
7680
7781 // create the provided submissions w/judge0 for running test cases
@@ -114,7 +118,7 @@ class Judge0Connector {
114118
115119 results . forEach ( ( submissionResult , index ) => {
116120 const isComplete =
117- submissionResult . status_id !== 1 && submissionResult . status_id !== 2 ;
121+ submissionResult . status . id !== 1 && submissionResult . status . id !== 2 ;
118122 if ( isComplete ) {
119123 allResults . push ( submissionResult ) ;
120124 } else {
@@ -146,7 +150,7 @@ class Judge0Connector {
146150 } ;
147151
148152 allResults . forEach ( ( submissionResult ) => {
149- switch ( submissionResult . status_id ) {
153+ switch ( submissionResult . status . id ) {
150154 case 3 : // Accepted
151155 categorizedResults . accepted . push ( submissionResult ) ;
152156 break ;
0 commit comments