PAN-52 Fixed issue with the Theorems API

This commit is contained in:
2019-03-21 10:59:14 -06:00
parent f8a1d8bf89
commit 4622c49cee
@@ -45,13 +45,20 @@ public class TheoremController {
@GetMapping("/branch")
public @ResponseBody
ResponseEntity<List<Theorem>> getAllTheoremsByBranch(@RequestParam("branch") final String branch) {
ResponseEntity<List<Theorem>> getAllTheoremsByBranch(@RequestParam("branch") String branch) {
LOG.info("Received request to query for theorems related to the {} branch of mathematics", branch);
if (branch == null) {
LOG.error("ERROR: branch was null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
branch = branch.toLowerCase();
if (branch.contains("_") || branch.contains("-")) {
branch = branch.replace("_", "\\s");
branch = branch.replace("-", "\\s");
}
LOG.debug("Querying for theorems with branch {}", branch);
final StopWatch stopWatch = new StopWatch();
@@ -188,8 +195,6 @@ public class TheoremController {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
theorem.setName(theorem.getName().toLowerCase());
LOG.debug("Saving new theorem");
final StopWatch stopWatch = new StopWatch();