Skip to content

Commit

Permalink
CIV-11361 add hearing notes (#3527)
Browse files Browse the repository at this point in the history
* add hearing notes for free form, and populate listing notes tab with notes

* Update Jenkinsfile_CNP
  • Loading branch information
drummondjm authored Nov 7, 2023
1 parent 1a2b55e commit 65b1ee8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ private CallbackResponse nullPreviousSelections(CallbackParams callbackParams) {
caseDataBuilder
.freeFormRecordedTextArea(null)
.freeFormOrderedTextArea(null)
.orderOnCourtsList(null);
.orderOnCourtsList(null)
.freeFormHearingNotes(null);
// Assisted orders
caseDataBuilder
.finalOrderMadeSelection(null).finalOrderDateHeardComplex(null)
Expand Down Expand Up @@ -426,12 +427,22 @@ private CallbackResponse addGeneratedDocumentToCollection(CallbackParams callbac
state = CASE_PROGRESSION;
}

if (caseData.getFinalOrderFurtherHearingComplex() != null
&& caseData.getFinalOrderFurtherHearingComplex().getHearingNotesText() != null) {
caseDataBuilder.hearingNotes(HearingNotes.builder()
.date(LocalDate.now())
.notes(caseData.getFinalOrderFurtherHearingComplex().getHearingNotesText())
.build());
// populate hearing notes in listing tab with hearing notes from either assisted or freeform order, if either exist.
if (caseData.getFinalOrderSelection().equals(ASSISTED_ORDER)) {
if (caseData.getFinalOrderFurtherHearingComplex() != null
&& caseData.getFinalOrderFurtherHearingComplex().getHearingNotesText() != null) {
caseDataBuilder.hearingNotes(HearingNotes.builder()
.date(LocalDate.now())
.notes(caseData.getFinalOrderFurtherHearingComplex().getHearingNotesText())
.build());
}
} else {
if (nonNull(caseData.getFreeFormHearingNotes())) {
caseDataBuilder.hearingNotes(HearingNotes.builder()
.date(LocalDate.now())
.notes(caseData.getFreeFormHearingNotes())
.build());
}
}

return AboutToStartOrSubmitCallbackResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ public boolean hasNoOngoingBusinessProcess() {
private final FreeFormOrderValues orderOnCourtInitiative;
private final FreeFormOrderValues orderWithoutNotice;
private final OrderOnCourtsList orderOnCourtsList;
private final String freeFormHearingNotes;

private Document finalOrderDocument;
@Builder.Default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void shouldPopulateFields_whenIsCalledAfterSdoDiffSol() {

}
}

@Nested
class MidEventValidateAndGenerateOrderDocumentPreview {
private static final String PAGE_ID = "validate-and-generate-document";
Expand Down Expand Up @@ -846,6 +846,23 @@ void shouldRePopulateHearingNotes_whenAssistedHearingNotesExist() {
assertThat(response.getData()).extracting("hearingNotes").extracting("notes").isEqualTo("test text hearing notes assisted order");
}

@Test
void shouldRePopulateHearingNotes_whenFreeFormHearingNotesExist() {
// Given
List<FinalOrderToggle> toggle = new ArrayList<>();
toggle.add(FinalOrderToggle.SHOW);
CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder()
.finalOrderSelection(FinalOrderSelection.FREE_FORM_ORDER)
.freeFormHearingNotes("test text hearing notes free form order")
.build();
CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT);
// When
when(judgeFinalOrderGenerator.generate(any(), any())).thenReturn(finalOrder);
var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params);
// Then
assertThat(response.getData()).extracting("hearingNotes").extracting("notes").isEqualTo("test text hearing notes free form order");
}

@Test
void shouldNotRePopulateHearingNotes_whenAssistedHearingNotesDoNotExist() {
// Given
Expand All @@ -863,6 +880,24 @@ void shouldNotRePopulateHearingNotes_whenAssistedHearingNotesDoNotExist() {
// Then
assertThat(response.getData()).extracting("hearingNotes").extracting("notes").isEqualTo("preexisting hearing notes");
}

@Test
void shouldNotRePopulateHearingNotes_whenFreeFormHearingNotesDoNotExist() {
// Given
List<FinalOrderToggle> toggle = new ArrayList<>();
toggle.add(FinalOrderToggle.SHOW);
CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder()
.finalOrderSelection(FinalOrderSelection.FREE_FORM_ORDER)
.finalOrderFurtherHearingToggle(toggle)
.hearingNotes(HearingNotes.builder().notes("preexisting hearing notes").build())
.build();
CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT);
// When
when(judgeFinalOrderGenerator.generate(any(), any())).thenReturn(finalOrder);
var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params);
// Then
assertThat(response.getData()).extracting("hearingNotes").extracting("notes").isEqualTo("preexisting hearing notes");
}
}

@Nested
Expand Down

0 comments on commit 65b1ee8

Please sign in to comment.