Skip to content

Commit

Permalink
chore(FSADT1-1524): updating response content (#1212)
Browse files Browse the repository at this point in the history
* feat(FSADT1-1524): added legacy predictive search

* chore(FSADT1-1524): updating predictive response

- Updated predictive search response for status
- Status should return description instead of code

* test(FSADT1-1524): fixing some tests

* test: fixing tests

* test(FSADT1-1524): fixing some tests

* test(FSADT1-1524): fixing some tests
  • Loading branch information
paulushcgcj authored Oct 7, 2024
1 parent 08c4680 commit 67d39f5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ca.bc.gov.app.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -22,14 +21,14 @@ public record PredictiveSearchResultDto(

@JsonProperty("name")
public String name() {
if (StringUtils.isNotBlank(this.clientFirstName)) {
return Stream.of(this.clientFirstName, this.clientMiddleName, this.clientName)
.filter(Objects::nonNull)
.map(String::trim)
.collect(Collectors.joining(" "));
} else {
return this.clientName;
}
String finalName = Stream.of(this.clientFirstName, this.clientMiddleName, this.clientName)
.filter(StringUtils::isNotBlank)
.map(String::trim)
.collect(Collectors.joining(" "));

return StringUtils.isNotBlank(this.doingBusinessAs)
? finalName + " (" + this.doingBusinessAs + ")"
: finalName;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Flux<ForestClientEntity> findClientByIncorporationOrName(
c.legal_middle_name as client_middle_name,
cl.city as city,
ctc.description as client_type,
c.client_status_code as status_code,
csc.description as status_code,
(
CASE WHEN c.client_number = :value THEN 112 ELSE 0 END +
CASE WHEN c.CLIENT_ACRONYM = :value THEN 111 ELSE 0 END +
Expand All @@ -85,6 +85,7 @@ Flux<ForestClientEntity> findClientByIncorporationOrName(
LEFT JOIN the.CLIENT_DOING_BUSINESS_AS dba ON c.client_number = dba.client_number
LEFT JOIN the.CLIENT_TYPE_CODE ctc ON c.client_type_code = ctc.client_type_code
LEFT JOIN the.CLIENT_LOCATION cl ON c.client_number = cl.client_number
LEFT JOIN the.CLIENT_STATUS_CODE csc ON c.client_status_code = csc.client_status_code
WHERE
(
c.client_number = :value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ private static Stream<Arguments> doingBusinessAs() {
private static Stream<Arguments> byPredictive() {
return Stream
.of(
Arguments.of("indian canada", "00000006", "INDIAN CANADA"),
Arguments.of("pollich", "00000114", "POLLICH-ABERNATHY"),
Arguments.of("kilback", "00000123", "REICHERT, KILBACK AND EMARD"),
Arguments.of("darbie", "00000145", "DARBIE BLIND"),
Arguments.of("darbie", "00000145", "DARBIE BLIND (MINYX)"),
Arguments.of("pietro", StringUtils.EMPTY, StringUtils.EMPTY)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ private static Stream<Arguments> byPredictive() {
.of(
Arguments.of("indian canada", "00000006", "INDIAN CANADA"),
Arguments.of("kilback", "00000123", "REICHERT, KILBACK AND EMARD"),
Arguments.of("darbie", "00000145", "DARBIE BLIND"),
Arguments.of("darbie", "00000145", "DARBIE BLIND (MINYX)"),
Arguments.of("pietro", StringUtils.EMPTY, StringUtils.EMPTY)
);
}
Expand Down

0 comments on commit 67d39f5

Please sign in to comment.