Skip to content

Commit

Permalink
PI-2099: Added court appearances
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcphee77 committed Aug 6, 2024
1 parent ee19a28 commit 295b868
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import uk.gov.justice.digital.hmpps.data.generator.*
import uk.gov.justice.digital.hmpps.datetime.EuropeLondon
import uk.gov.justice.digital.hmpps.user.AuditUserRepository
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.ZonedDateTime

Expand Down Expand Up @@ -135,7 +136,7 @@ class DataLoader(
ZonedDateTime.of(LocalDate.now().minusDays(1), LocalTime.NOON, EuropeLondon)
)
val outcome = SentenceGenerator.OUTCOME
val courtAppearance = SentenceGenerator.generateCourtAppearance(noSentenceEvent, outcome, ZonedDateTime.now())
val courtAppearance = SentenceGenerator.generateCourtAppearance(noSentenceEvent, outcome, LocalDateTime.now())
em.saveAll(noSentenceEvent, noSentenceManager, outcome, courtAppearance)

val newEvent = SentenceGenerator.generateEvent(PersonGenerator.NEW_TO_PROBATION, referralDate = LocalDate.now())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object SentenceGenerator {
val COURT_APPEARANCE = generateCourtAppearance(
CURRENTLY_MANAGED,
OUTCOME,
ZonedDateTime.of(LocalDate.now(), LocalTime.NOON, EuropeLondon)
LocalDateTime.now()
)

val CURRENT_ORDER_MANAGER = generateOrderManager(
Expand Down Expand Up @@ -182,7 +182,7 @@ object SentenceGenerator {
fun generateCourtAppearance(
event: Event,
outcome: Outcome,
appearanceDate: ZonedDateTime,
appearanceDate: LocalDateTime,
softDeleted: Boolean = false,
id: Long = IdGenerator.getAndIncrement()
) = CourtAppearance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ internal class ConvictionByCrnAndEventIdIntegrationTest {
),
CourtAppearanceBasic(
COURT_APPEARANCE.id,
COURT_APPEARANCE.appearanceDate.toLocalDateTime(),
COURT_APPEARANCE.appearanceDate,
COURT_APPEARANCE.court.code,
COURT_APPEARANCE.court.courtName,
KeyValue(COURT_APPEARANCE.appearanceType.code, COURT_APPEARANCE.appearanceType.description),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ internal class ConvictionByCrnIntegrationTest {
),
CourtAppearanceBasic(
COURT_APPEARANCE.id,
COURT_APPEARANCE.appearanceDate.toLocalDateTime(),
COURT_APPEARANCE.appearanceDate,
COURT_APPEARANCE.court.code,
COURT_APPEARANCE.court.courtName,
KeyValue(COURT_APPEARANCE.appearanceType.code, COURT_APPEARANCE.appearanceType.description),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import uk.gov.justice.digital.hmpps.integrations.delius.event.sentence.entity.Co
import uk.gov.justice.digital.hmpps.integrations.delius.person.entity.Person
import uk.gov.justice.digital.hmpps.integrations.delius.provider.entity.Staff
import java.time.LocalDate
import java.time.ZonedDateTime
import java.time.LocalDateTime

@Entity
@Immutable
Expand All @@ -26,7 +26,7 @@ class CourtAppearance(
@JoinColumn(name = "outcome_id")
val outcome: Outcome?,

val appearanceDate: ZonedDateTime,
val appearanceDate: LocalDateTime,

@Column(name = "soft_deleted", columnDefinition = "number")
val softDeleted: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ConvictionService(
fun CourtAppearance.toCourtAppearanceBasic(): CourtAppearanceBasic =
CourtAppearanceBasic(
id,
appearanceDate.toLocalDateTime(),
appearanceDate,
court.code,
court.courtName,
KeyValue(appearanceType.code, appearanceType.description),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CourtAppearanceService(

fun CourtAppearance.toCourtAppearance() = CourtAppearanceBasic(
courtAppearanceId = id,
appearanceDate = appearanceDate.toLocalDateTime(),
appearanceDate = appearanceDate,
courtCode = court.code,
courtName = court.courtName,
appearanceType = KeyValue(court.courtType.code, court.courtType.description),
Expand Down

0 comments on commit 295b868

Please sign in to comment.