Skip to content

[APB-11327] add riskingCompletedDate when all risking results receive…#66

Merged
gitwojciech merged 8 commits intomainfrom
APB-11327_2
May 7, 2026
Merged

[APB-11327] add riskingCompletedDate when all risking results receive…#66
gitwojciech merged 8 commits intomainfrom
APB-11327_2

Conversation

@gitwojciech
Copy link
Copy Markdown
Contributor

…d from risking

for
appDate <- application.riskingCompletedDate
individualDates <- individuals.map(_.riskingCompletedDate).toList.sequence
yield individualDates.foldLeft(appDate)((latest, d) => if d.isAfter(latest) then d else latest)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rewrite this with simpler (appDate :: individualDates).max please

):

/** Latest moment a Minerva result landed across the entity and all individuals. None if any record is still missing its `riskingCompletedDate`. */
def latestRiskingCompletedDate: Option[Instant] =
Copy link
Copy Markdown
Contributor

@paweldigital paweldigital May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used only in one place - could you move this to the controller please?

Maybe we can just name it riskingCompletedDate - that should be self explanatory enough so a Scala comment won’t be required.

Comment on lines +35 to +36
failures: Option[List[IndividualFailure]],
riskingCompletedDate: Option[Instant]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this implementation, it is possible to have empty failures while still having a defined riskingCompletedDate.

Could we remodel it to include the date together with riskingResults? Maybe something like

final case class IndividualFailures(
  failures: List[IndividualFailure],
  receivedDate: Instant
)

//then 

...
failures: Option[IndividualFailures],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - same as before List.empty

@gitwojciech gitwojciech merged commit 03be656 into main May 7, 2026
1 check passed
@gitwojciech gitwojciech deleted the APB-11327_2 branch May 7, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants