Skip to content

Commit

Permalink
PI-2056 Handle null status details (#3589)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Apr 5, 2024
1 parent 901470c commit 3cab738
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ data class ApplicationStatus(
val name: String,
val label: String,
val description: String,
val statusDetails: List<ApplicationStatusDetail>,
val statusDetails: List<ApplicationStatusDetail>?,
)

data class ApplicationStatusDetail(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Cas2Service(

fun applicationStatusUpdated(event: HmppsDomainEvent) {
val details = eventDetailsClient.getApplicationStatusUpdatedDetails(event.url)
val statusDetailsList = details.eventDetails.newStatus.statusDetails
?.joinToString("${System.lineSeparator()}|* ", "${System.lineSeparator()}|* ") { it.label } ?: ""
val success = contactService.createContact(
crn = event.crn,
type = ContactType.REFERRAL_UPDATED,
Expand All @@ -40,8 +42,7 @@ class Cas2Service(
notes = """
|Application status was updated to: ${details.eventDetails.newStatus.label}
|
|Details: ${details.eventDetails.newStatus.description}
|* ${details.eventDetails.newStatus.statusDetails.joinToString(separator = System.lineSeparator() + "|* ") { it.label }}
|Details: ${details.eventDetails.newStatus.description}$statusDetailsList
|
|Details of the application can be found here: ${details.eventDetails.applicationUrl}
""".trimMargin(),
Expand Down

0 comments on commit 3cab738

Please sign in to comment.