fix(donate): offset the no of donations on prod (#37443)

This commit is contained in:
mrugesh
2019-10-22 00:08:22 +05:30
committed by GitHub
parent 073ea9a4ef
commit 9fb9ce3085

View File

@ -179,9 +179,20 @@ export const userSelector = state => {
};
export const sessionMetaSelector = state => state[ns].sessionMeta;
export const activeDonationsSelector = state =>
export const activeDonationsSelector = state => {
const donors =
Number(sessionMetaSelector(state).activeDonations) +
Number(PAYPAL_SUPPORTERS || 0);
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 {