Skip to content

Commit

Permalink
Merge pull request #123 from BuildFire/fix-redeem-daily-limit
Browse files Browse the repository at this point in the history
Fix redeem daily limit & redeem zero points
  • Loading branch information
charkhaw authored Aug 31, 2023
2 parents 4daa373 + 06d00b6 commit 593b606
Show file tree
Hide file tree
Showing 9 changed files with 6,351 additions and 71 deletions.
6 changes: 3 additions & 3 deletions control/content/controllers/content.reward.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@
if(!ContentReward.item.title || ContentReward.item.title.length == 0) {
ContentReward.validations.title = true;
}
if ((!ContentReward.item.pointsToRedeem || ContentReward.item.pointsToRedeem.length == 0) &&
if (((!ContentReward.item.pointsToRedeem && ContentReward.item.pointsToRedeem !== 0) || ContentReward.item.pointsToRedeem.length == 0) &&
(!ContentReward.item.pointsPerItem || ContentReward.item.pointsPerItem.length == 0) ){
ContentReward.validations.points = true;
}
if (!ContentReward.validations.title && !ContentReward.validations.points){
// "Hack" for overcoming pointsToRedeem validation if the item can only be bought but not redeemed
if(ContentReward.item.pointsPerItem && ContentReward.item.pointsPerItem.length > 0
&&
(!ContentReward.item.pointsToRedeem || ContentReward.item.pointsToRedeem.length === 0 || ContentReward.item.pointsToRedeem === '38762499627')) {
((!ContentReward.item.pointsToRedeem && ContentReward.item.pointsToRedeem !== 0) || ContentReward.item.pointsToRedeem.length === 0 || ContentReward.item.pointsToRedeem === '38762499627')) {
ContentReward.item.pointsToRedeem = '38762499627'
}
ContentReward.addReward(JSON.parse(angular.toJson(ContentReward.item)));
Expand Down Expand Up @@ -253,7 +253,7 @@
/*validate the required fields whether its there or not */
ContentReward.isValidReward = function (reward) {
if (reward)
return (reward.title && reward.pointsToRedeem);
return (reward.title && (reward.pointsToRedeem || reward.pointsToRedeem === 0));
};

/*This method is used to get the rewards details*/
Expand Down
4 changes: 2 additions & 2 deletions control/content/templates/reward.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>Item Details</h1>
<span class="tip btn-info-icon btn-primary"><span class="cp-tooltip">If this field is blank, then “Points per Item” cannot be blank. If this field has a value greater than zero, then this item will show up as a reward to redeem on the Loyalty feature’s main screen</span>
</div>
<div class="main col-md-9 pull-right">
<input ng-if="ContentReward.item.pointsToRedeem != '38762499627'" type="number" class="form-control" ng-model = "ContentReward.item.pointsToRedeem">
<input ng-if="ContentReward.item.pointsToRedeem != '38762499627'" type="number" min="0" class="form-control" ng-model = "ContentReward.item.pointsToRedeem">
<input ng-if="ContentReward.loading && ContentReward.item.pointsToRedeem == '38762499627'" type="number" class="form-control" >
</div>
</div>
Expand Down Expand Up @@ -73,7 +73,7 @@ <h1>Item Details</h1>
<div class="main col-md-9 pull-right" style="margin-right: 1px; margin-top: 5px;">
<div class="col-md-6 pull-right padding-right-zero padding-left-ten">
<a class="btn btn-success pull-right btn-save"
ng-disabled="ContentReward.loading || ContentReward.item.listImage == ''|| ContentReward.item.pointsPerItem=='' || ContentReward.item.pointsToRedeem=='' || ContentReward.item.title == ''"
ng-disabled="ContentReward.loading || ContentReward.item.listImage == ''|| ContentReward.item.pointsPerItem=='' || ((ContentReward.item.pointsToRedeem=='' || !ContentReward.item.pointsToRedeem) && ContentReward.item.pointsToRedeem !== 0) || ContentReward.item.title == ''"
ng-click="ContentReward.addingReward()">
Save
</a>
Expand Down
Loading

0 comments on commit 593b606

Please sign in to comment.