PAN-52 Fixed issue with the Theorems API

This commit is contained in:
2019-03-21 10:32:57 -06:00
parent 6b7cf5cd91
commit 1e15082fcc
@@ -107,13 +107,20 @@ public class TheoremController {
@GetMapping("/name") @GetMapping("/name")
public @ResponseBody public @ResponseBody
ResponseEntity<List<Theorem>> getAllTheoremsByName(@RequestParam("name") final String name) { ResponseEntity<List<Theorem>> getAllTheoremsByName(@RequestParam("name") String name) {
LOG.info("Received request to query for theorems whose name is {}", name); LOG.info("Received request to query for theorems whose name is {}", name);
if (name == null) { if (name == null) {
LOG.error("ERROR: name was null"); LOG.error("ERROR: name was null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST); return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
} }
name = name.toLowerCase();
if (name.contains("_") || name.contains("-")) {
name = name.replace("-", "\\s");
name = name.replace("-", "\\s");
}
LOG.debug("Querying for theorems with name {}", name); LOG.debug("Querying for theorems with name {}", name);
final StopWatch stopWatch = new StopWatch(); final StopWatch stopWatch = new StopWatch();
@@ -181,6 +188,8 @@ 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();