Added check for if person is empty in an observations request.
This commit is contained in:
parent
95b40bac3d
commit
563bbd17da
@ -133,7 +133,12 @@ class Controller {
|
||||
}
|
||||
}.orElse(listOf())
|
||||
}
|
||||
if (observationsRequest.site != null) {
|
||||
else if(observationsRequest.person != null && observationsRequest.person.isNotEmpty() && observationsRequest.site != null) {
|
||||
val person = personRepository.findByName(observationsRequest.person) ?: return listOf()
|
||||
val site = siteRepository.findById(observationsRequest.site).get()
|
||||
return observationRepository.findBySiteAndPersonsAndDateBetween(site, person, observationsRequest.startDate, observationsRequest.endDate)
|
||||
}
|
||||
else if (observationsRequest.site != null) {
|
||||
return siteRepository.findById(observationsRequest.site).map {
|
||||
when {
|
||||
(observationsRequest.whom == null || observationsRequest.whom.isEmpty()) -> observationRepository.findBySiteAndDateBetween(site = it,
|
||||
|
Loading…
Reference in New Issue
Block a user