Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PI-2106: Fixes to align with com api #4148

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ interface AttendanceRepository : JpaRepository<CaseNote, Long> {
WHERE contact.offenderId = :personId
AND contact.eventId = :eventId
AND contact.date <= :contactDate
AND (contact.enforcementContact = true OR contact.outcome != null)
AND (contact.enforcementContact = true OR contact.outcome is not null)
AND contact.type.attendanceContact = true
AND contact.type.nationalStandards = true
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,14 @@ interface NsiRepository : JpaRepository<Nsi, Long> {
@Query(
"""
select nsi from Nsi nsi
where nsi.id = :nsiId and nsi.eventId = :eventId
where nsi.id = :nsiId
"""

)
fun findByNsiId(nsiId: Long, eventId: Long): Nsi?
fun findByNsiId(nsiId: Long): Nsi?

fun findByPersonIdAndEventIdAndTypeCodeIn(personId: Long, eventId: Long, codes: List<String>): List<Nsi>
}

fun NsiRepository.getByNsiId(nsiId: Long, eventId: Long) =
findByNsiId(nsiId, eventId) ?: throw NotFoundException("NSI with id $nsiId not found")
fun NsiRepository.getByNsiId(nsiId: Long) =
findByNsiId(nsiId) ?: throw NotFoundException("NSI with id $nsiId not found")

Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class InterventionService(

fun getNsiByNsiId(crn: String, convictionId: Long, nsiId: Long): Nsi {
val person = personRepository.getPerson(crn)
val event = eventRepository.getByPersonAndEventNumber(person, convictionId)
return nsiRepository.getByNsiId(nsiId, event.id).toNsi()
eventRepository.getByPersonAndEventNumber(person, convictionId)
return nsiRepository.getByNsiId(nsiId).toNsi()
}
}

Expand Down
Loading