select all members when sending fees to the ORD if memberIds is empty

This commit is contained in:
Bilal Catic
2019-08-31 02:12:12 +02:00
parent b7067a8eb6
commit d55131e1f2
3 changed files with 23 additions and 11 deletions

View File

@@ -247,6 +247,10 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => {
}
});
if (membershipFeeForDiscount === 0){
return null; //This member's plan is not eligible for a discount
}
const totalChargeFee = membershipFeeForDiscount + totalBookingChargedFee;
let discount = 0;
@@ -261,7 +265,7 @@ const createNegativeFeeForDiscount = (memberData, dateRange) => {
const discountRate = discountPercentage / 100;
discount = totalChargeFee * discountRate;
}else{
return null;
return null; //Not enough hours to earn a discount
}
const formattedName = `[Discount] Total booked : ${totalBookedHours.toFixed(2)} hrs, Total charged : ${totalChargedHours.toFixed(2)} hrs, Discount : ${discountPercentage} %`;
@@ -317,7 +321,7 @@ const getMembersFeesForDateRange = (dateRange, memberIds) => {
membersMap[member.memberId] = {
member,
bookingData: Object.assign({}, oneMemberObject),
membershipFees: membershipsMap[member.memberId],
membershipFees: membershipsMap[member.memberId] || [],
};
});