Skip to content
Snippets Groups Projects

Fix the verdict end point and test it

2 files
+ 198
4
Compare changes
  • Side-by-side
  • Inline

Files

package nl.tudelft.ewi.auta.core.controller;
import nl.tudelft.ewi.auta.core.database.Repositories;
import nl.tudelft.ewi.auta.core.response.ErrorCode;
import nl.tudelft.ewi.auta.core.response.Response;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
@@ -35,7 +34,7 @@ public class ReportController extends ControllerBase {
this.repositories.getAssignmentRepository().findExisting(aid);
this.repositories.getSubmissionRepository().findExisting(aid, sid);
final var entityContainerOptional = this.repositories.getEntityRepository()
.findByParentIds(aid, sid);
.findByParentIds(sid, aid);
if (entityContainerOptional.isEmpty()) {
res.put("verdict", "pending");
@@ -45,9 +44,10 @@ public class ReportController extends ControllerBase {
final var entityContainer = entityContainerOptional.get();
if (entityContainer.hadException()) {
res.put("verdict", "error");
res.addError(ErrorCode.INTERNAL, entityContainer.getExceptionMessage());
return ResponseEntity.status(ErrorCode.INTERNAL.getStatus()).body(res);
return ResponseEntity.ok(res);
}
res.put("verdict", entityContainer.getVerdict().toString().toLowerCase());
return ResponseEntity.ok(res);
}
}
Loading