diff --git a/persistence/src/main/java/edu/msudenver/tsp/persistence/controller/TheoremController.java b/persistence/src/main/java/edu/msudenver/tsp/persistence/controller/TheoremController.java index 71d5e62..d6bae87 100644 --- a/persistence/src/main/java/edu/msudenver/tsp/persistence/controller/TheoremController.java +++ b/persistence/src/main/java/edu/msudenver/tsp/persistence/controller/TheoremController.java @@ -45,13 +45,20 @@ public class TheoremController { @GetMapping("/branch") public @ResponseBody - ResponseEntity> getAllTheoremsByBranch(@RequestParam("branch") final String branch) { + ResponseEntity> 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();