From 9fb9ce3085585287516def3c519e82f3575619be Mon Sep 17 00:00:00 2001 From: mrugesh <1884376+raisedadead@users.noreply.github.com> Date: Tue, 22 Oct 2019 00:08:22 +0530 Subject: [PATCH] fix(donate): offset the no of donations on prod (#37443) --- client/src/redux/index.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/src/redux/index.js b/client/src/redux/index.js index 4e984fa43b..07349644f7 100644 --- a/client/src/redux/index.js +++ b/client/src/redux/index.js @@ -179,9 +179,20 @@ export const userSelector = state => { }; export const sessionMetaSelector = state => state[ns].sessionMeta; -export const activeDonationsSelector = state => - Number(sessionMetaSelector(state).activeDonations) + - Number(PAYPAL_SUPPORTERS || 0); +export const activeDonationsSelector = state => { + const donors = + Number(sessionMetaSelector(state).activeDonations) + + Number(PAYPAL_SUPPORTERS || 0) - + // Note 1: + // Offset the no of inactive donations, that are not yet normalized in db + // TODO: This data needs to be fetched and updated in db from Stripe + 2500; + // Note 2: + // Due to the offset above, non-prod data needs to be adjusted for -ve values + return donors > 0 + ? donors + : Number(sessionMetaSelector(state).activeDonations); +}; function spreadThePayloadOnUser(state, payload) { return {