Skip to content
Snippets Groups Projects

Location apporval form validation update

Merged Rhys Evans requested to merge locationApporvalFormValidationUpdate into main
6 files
+ 141
27
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -79,15 +79,16 @@ public class LandmarksController {
int locationID = locationRepository.nametoLocationID(location.getLocationName());
// converts valid response using Location constructor into a submittable format to the sql table
System.out.println(locCoord.getLocationCoordsLong());
LocationsCoordinates ALocCoord = new LocationsCoordinates(locationID, locCoord.getLocationCoordsLat(), locCoord.getLocationCoordsLong());
boolean checkIfCoorsWithinBoundaries = placesCoordinatesRepo.checkIfCoordsAreWithinTownBoundary(ALocCoord);
if (checkIfCoorsWithinBoundaries==false){ // if coords outside associated town, form is returned to original state
return new ModelAndView("redirect:/checkpointApproval");
return new ModelAndView("redirect:/checkpointApproval?error");
}
placesCoordinatesRepo.addLocationCoord(ALocCoord); // adds valid landmark to locations table
locationRepository.updateApprovalStatus(locationID); // updates approval status accordingly
System.out.println(placesCoordinatesRepo.getAllLocationCoords());
ModelAndView modelAndView = new ModelAndView("redirect:/home"); //redirects back top form in case admin wants to input second location
ModelAndView modelAndView = new ModelAndView("redirect:/mobile-home"); //redirects back top form in case admin wants to input second location
return modelAndView;
// }
Loading