PAN-52 Fixed issue with the Theorems API
This commit is contained in:
+8
-3
@@ -45,13 +45,20 @@ public class TheoremController {
|
|||||||
|
|
||||||
@GetMapping("/branch")
|
@GetMapping("/branch")
|
||||||
public @ResponseBody
|
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);
|
LOG.info("Received request to query for theorems related to the {} branch of mathematics", branch);
|
||||||
if (branch == null) {
|
if (branch == null) {
|
||||||
LOG.error("ERROR: branch was null");
|
LOG.error("ERROR: branch was null");
|
||||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
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);
|
LOG.debug("Querying for theorems with branch {}", branch);
|
||||||
|
|
||||||
final StopWatch stopWatch = new StopWatch();
|
final StopWatch stopWatch = new StopWatch();
|
||||||
@@ -188,8 +195,6 @@ public class TheoremController {
|
|||||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
theorem.setName(theorem.getName().toLowerCase());
|
|
||||||
|
|
||||||
LOG.debug("Saving new theorem");
|
LOG.debug("Saving new theorem");
|
||||||
|
|
||||||
final StopWatch stopWatch = new StopWatch();
|
final StopWatch stopWatch = new StopWatch();
|
||||||
|
|||||||
Reference in New Issue
Block a user