Skip to content

Commit

Permalink
PI-2396 - use entered_notional_end_date if populated, else notional_e… (
Browse files Browse the repository at this point in the history
#4073)

PI-2396 - use entered_notional_end_date if populated, else notional_end_date, when returning  expectedEndDate field
  • Loading branch information
achimber-moj authored Jul 26, 2024
1 parent 8384c20 commit f7042c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,19 @@ class Disposal(
val startDate: LocalDate,

@Column(name = "notional_end_date")
val expectedEndDate: LocalDate? = null,
val notionalEndDate: LocalDate? = null,

@Column(name = "entered_notional_end_date")
val enteredEndDate: LocalDate? = null,

@Column(name = "active_flag", columnDefinition = "number")
val active: Boolean = true,

@Column(name = "soft_deleted", columnDefinition = "number")
val softDeleted: Boolean = false
)
) {
fun expectedEndDate() = enteredEndDate ?: notionalEndDate
}

@Immutable
@Table(name = "r_disposal_type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ConvictionService(
}

private fun Disposal.asModel(custody: uk.gov.justice.digital.hmpps.entity.Custody?) =
Sentence(id, startDate, expectedEndDate, custody?.custodyModel())
Sentence(id, startDate, expectedEndDate(), custody?.custodyModel())

private fun ReferenceData.custodialStatus() = CustodyStatus(code, description)
private fun uk.gov.justice.digital.hmpps.entity.Custody.custodyModel() =
Expand Down

0 comments on commit f7042c1

Please sign in to comment.