diff --git a/projects/soc-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/ConvictionEventEntity.kt b/projects/soc-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/ConvictionEventEntity.kt index 52d62f180e..6e8aa6e04f 100644 --- a/projects/soc-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/ConvictionEventEntity.kt +++ b/projects/soc-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/ConvictionEventEntity.kt @@ -172,7 +172,7 @@ interface ConvictionEventRepository : JpaRepository "disposal.type" ] ) - fun getAllByConvictionEventPersonIdOrderByConvictionDateDesc(personId: Long): List + fun getAllByConvictionEventPersonIdAndActiveIsTrueOrderByConvictionDateDesc(personId: Long): List @EntityGraph( attributePaths = [ @@ -212,4 +212,4 @@ interface ConvictionEventRepository : JpaRepository } fun ConvictionEventRepository.getLatestConviction(personId: Long) = - getAllByConvictionEventPersonIdOrderByConvictionDateDesc(personId).firstOrNull() + getAllByConvictionEventPersonIdAndActiveIsTrueOrderByConvictionDateDesc(personId).firstOrNull()