PAN-52 Fixed issue with the Theorems API

This commit is contained in:
2019-03-21 10:25:52 -06:00
parent ae15ec8073
commit 80f55c4879
2 changed files with 18 additions and 7 deletions
@@ -75,19 +75,21 @@ public class TheoremController {
@GetMapping("/proven_status")
public @ResponseBody
ResponseEntity<List<Theorem>> getAllTheoremsByProvenStatus(@PathVariable("proven_status") final Boolean provenStatus) {
ResponseEntity<List<Theorem>> getAllTheoremsByProvenStatus(@RequestParam("proven_status") final String provenStatus) {
LOG.info("Received request to query for theorems whose proven status is {}", provenStatus);
if (provenStatus == null) {
LOG.error("ERROR: status was null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
LOG.debug("Querying for theorems with proven status {}", provenStatus);
final Boolean isProven = Boolean.parseBoolean(provenStatus);
LOG.debug("Querying for theorems with proven status {}", isProven);
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<Theorem> listOfTheorems = theoremRepository.findByProvenStatus(provenStatus);
final List<Theorem> listOfTheorems = theoremRepository.findByProvenStatus(isProven);
stopWatch.stop();
@@ -95,11 +97,11 @@ public class TheoremController {
LOG.info("Returning list of all theorems with size {}", listOfTheorems.size());
if (listOfTheorems.isEmpty()) {
LOG.warn("No theorems were found for proven status {}", provenStatus);
LOG.warn("No theorems were found for proven status {}", isProven);
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
LOG.info("Returning list of theorems with proven status {}", provenStatus);
LOG.info("Returning list of theorems with proven status {}", isProven);
return new ResponseEntity<>(listOfTheorems, HttpStatus.OK);
}