Skip to content

Commit e51b2f6

Browse files
committed
Merge branch 'Jmpi-bug-notification-screen-pointing-to-deleted-GR' into Jmpi-bug-notification-screen-pointing-to-deleted-GR-2
2 parents bd32f54 + 32c1c06 commit e51b2f6

File tree

7 files changed

+23
-12
lines changed

7 files changed

+23
-12
lines changed

JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/Ask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ static CompletionStage<BackEnd.PostUpdateNotificationResponse> postUpdateNotific
330330
CompletionStage<BackEnd.PostUpdateNotificationResponse> stage = AskPattern
331331
.ask(backEnd,
332332
replyTo -> new BackEnd.PostUpdateNotificationRequest(replyTo,
333-
notificationRequest.notificationId()),
333+
notificationRequest.notificationId(),
334+
notificationRequest.currentGoldenId()),
334335
java.time.Duration.ofSeconds(11),
335336
actorSystem.scheduler());
336337
return stage.thenApply(response -> response);

JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/BackEnd.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ private Behavior<Event> getGidsPagedHandler(final GetGidsPagedRequest request) {
435435

436436
private Behavior<Event> postUpdateNotificationHandler(final PostUpdateNotificationRequest request) {
437437
try {
438-
psqlNotifications.updateNotificationState(request.notificationId);
438+
psqlNotifications.updateNotificationState(request.notificationId, request.currentGoldenId);
439439
} catch (SQLException exception) {
440440
LOGGER.error(exception.getMessage());
441441
}
@@ -608,7 +608,8 @@ public record PatchIidNewGidLinkResponse(Either<MpiGeneralError, LinkInfo> linkI
608608

609609
public record PostUpdateNotificationRequest(
610610
ActorRef<PostUpdateNotificationResponse> replyTo,
611-
String notificationId) implements Event {
611+
String notificationId,
612+
String currentGoldenId) implements Event {
612613
}
613614

614615
public record PostUpdateNotificationResponse() implements EventResponse {

JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/PsqlNotifications.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,19 @@ void insertCandidates(
167167
}
168168

169169
void updateNotificationState(
170-
final String id) throws SQLException {
170+
final String notificationId,
171+
final String currentGoldenId) throws SQLException {
171172
psqlClient.connect();
172173
try (Statement stmt = psqlClient.createStatement()) {
173-
ResultSet rs = stmt.executeQuery(String.format(Locale.ROOT,
174+
stmt.executeQuery(String.format(Locale.ROOT,
174175
"update notification set state = '%s' where id = '%s'",
175176
"CLOSED",
176-
id));
177+
notificationId));
178+
stmt.executeQuery(String.format(Locale.ROOT,
179+
"update notification set golden_id = '%s' where id = '%s'",
180+
currentGoldenId,
181+
notificationId));
182+
LOGGER.info("Updated notification {} with new currentGoldenId {} ", notificationId, currentGoldenId);
177183
psqlClient.commit();
178184
}
179185
}

JeMPI_Apps/JeMPI_LibShared/src/main/java/org/jembi/jempi/shared/models/NotificationRequest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@JsonInclude(JsonInclude.Include.NON_NULL)
77
public record NotificationRequest(
88
@JsonProperty("notificationId") String notificationId,
9-
@JsonProperty("state") String state) {
9+
@JsonProperty("state") String state,
10+
@JsonProperty("currentGoldenId") String currentGoldenId) {
1011

1112
}

JeMPI_Apps/JeMPI_UI/src/components/notificationWorklist/NotificationWorklist.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const NotificationWorklist = () => {
6565
endDateFilter.format('YYYY-MM-DD HH:mm:ss'),
6666
selectedStates
6767
),
68-
refetchOnWindowFocus: false,
68+
refetchOnWindowFocus: true,
6969
keepPreviousData: true
7070
})
7171

JeMPI_Apps/JeMPI_UI/src/components/reviewLink/ReviewLink.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ const ReviewLink = () => {
8989
}
9090
})
9191

92-
const updateNotification = () => {
92+
const updateNotification = (currentGoldenId: string) => {
9393
mutateNotification.mutate(
9494
{
95-
notificationId: payload?.notificationId
95+
notificationId: payload?.notificationId,
96+
currentGoldenId: currentGoldenId,
9697
},
9798
{
9899
onSuccess: () => {
@@ -117,7 +118,7 @@ const ReviewLink = () => {
117118
{
118119
onSuccess: data => {
119120
if (payload?.notificationId) {
120-
updateNotification()
121+
updateNotification(goldenRecord ? goldenRecord.uid : '')
121122
}
122123
enqueueSnackbar('New record linked', {
123124
variant: 'success'
@@ -153,7 +154,7 @@ const ReviewLink = () => {
153154
{
154155
onSuccess: () => {
155156
if (payload?.notificationId) {
156-
updateNotification()
157+
updateNotification(goldenRecord.uid)
157158
navigate('/notifications')
158159
} else {
159160
navigate(`/record-details/${id}`)

JeMPI_Apps/JeMPI_UI/src/types/BackendResponse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88

99
export interface NotificationRequest {
1010
notificationId: string
11+
currentGoldenId: string
1112
}
1213

1314
export interface LinkRequest {

0 commit comments

Comments
 (0)