From edf033ba591f266217b72b098bd2f7aa522d0cf2 Mon Sep 17 00:00:00 2001 From: Azmi TOUIL <42934070+AzmiTouil@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:51:09 +0200 Subject: [PATCH] feat: Disable realization status update from stream once reward sent - MEED-3437 - Meeds-io/MIPs#122 (#513) This PR will ensure disabling the update achievement status from the stream once the reward is sent. --- .../exoplatform/wallet/reward/rest/RewardReportREST.java | 7 ++++++- .../webapp/vue-app/achievementsExtensions/js/service.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wallet-api/src/main/java/org/exoplatform/wallet/reward/rest/RewardReportREST.java b/wallet-api/src/main/java/org/exoplatform/wallet/reward/rest/RewardReportREST.java index 33893d272..d7c439466 100644 --- a/wallet-api/src/main/java/org/exoplatform/wallet/reward/rest/RewardReportREST.java +++ b/wallet-api/src/main/java/org/exoplatform/wallet/reward/rest/RewardReportREST.java @@ -258,7 +258,12 @@ public Response getRewardReportPeriods(@Parameter(description = "Offset of resul if (offset < 0) { return Response.status(Response.Status.BAD_REQUEST).entity("Offset must be 0 or positive").build(); } - List rewardPeriods = rewardReportService.findRewardPeriodsBetween(from, to, offset, limit); + List rewardPeriods; + if (from >= 0 && to > 0) { + rewardPeriods = rewardReportService.findRewardPeriodsBetween(from, to, offset, limit); + } else { + rewardPeriods = rewardReportService.findRewardReportPeriods(offset, limit); + } return Response.ok(rewardPeriods).build(); } diff --git a/wallet-webapps/src/main/webapp/vue-app/achievementsExtensions/js/service.js b/wallet-webapps/src/main/webapp/vue-app/achievementsExtensions/js/service.js index 4aa50e4a8..11d922a7f 100644 --- a/wallet-webapps/src/main/webapp/vue-app/achievementsExtensions/js/service.js +++ b/wallet-webapps/src/main/webapp/vue-app/achievementsExtensions/js/service.js @@ -17,7 +17,7 @@ * */ export function getRewardReportPeriods(from, to, offset, limit) { - return fetch(`/portal/rest/wallet/api/reward/periods?from=${from}&to=${to}&offset=${offset || 0}&limit=${limit|| 10}`, { + return fetch(`/portal/rest/wallet/api/reward/periods?from=${from || 0}&to=${to || 0}&offset=${offset || 0}&limit=${limit|| 10}`, { method: 'GET', credentials: 'include', headers: {