From 2380d6a6d4c033cb910040cc633c21c04cd6915e Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Fri, 21 Dec 2018 07:26:42 +0000 Subject: [PATCH] This closes #78 and closes #80. What I thought was a desired equitable behavior for eab was actually a bug. Now behavior is predictable. Only checks for 0.00 and 0, so 0.0 would create an issue, but unlikely to happen. --- Connections/database_functions.php | 5 ----- js/transaction.js | 12 +++++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Connections/database_functions.php b/Connections/database_functions.php index 9dff555..1aa263c 100644 --- a/Connections/database_functions.php +++ b/Connections/database_functions.php @@ -88,11 +88,6 @@ define("SPECIAL_VOLUNTEER_DISCOUNT",50); // PERCENTAGE // e.g. for sweat equity limit of $200 for contact_id 500: array(500 => 200) $custom_sweat_equity_limit = array(); -// Determines the behaviour of Bicycles (transaction_type_id) for volunteer to earn-a-bike purchases. -// Keeping things equitable, if a patron decides to purchase a bike, rather than earning it, -// that counts to the EAB limit for the year. -define("EARN_A_BIKE_LIMIT",1); - // Determine if stand time behaviour will be based on the SWEAT_EQUITY_LIMIT with discounts applied, // or 1 to 1 (1hr of volunteering === 1hr of free stand time) regardless of the SWEAT_EQUITY_LIMIT define("REDEEM_ONE_TO_ONE", true); diff --git a/js/transaction.js b/js/transaction.js index 0cfbdbe..78a5eb3 100644 --- a/js/transaction.js +++ b/js/transaction.js @@ -89,7 +89,6 @@ $(function() { } } ); - // paid or not? $(":checked").parent("td").prev().children().not("#payment_type_label").hide(); // need to watch that not introduction bugs $(".paid").click(function() { @@ -1036,6 +1035,7 @@ $(function() { sold_to.change(function() { + //sold_to.hide(); amount.prop("disabled",""); var membership_obj; //reuse this object @@ -1521,12 +1521,18 @@ $(function() { } else { vhr = parseFloat($("#redeemable_hours").val()); } + - // Don't require paid to be selected, only amount >= 0 + // Don't require paid to be selected, only amount >= 0 + // + // Here is where equitable behaviour for earned bikes could be turned off/on + // However, it actually was a feature induced bug or undesired depending how you look at it, + // see #78 and #80, + // because vhr always became 0 when amount was added if spinner was not used var max_bike_earned = 0, maximum_allowable_earned_bikes; if ($("#transaction_type").val() === "Bicycles") { // hours were redeemed and this is a Bicycle transaction - if (vhr !== "0.00") { + if (vhr !== "0.00" && vhr !== 0) { max_bike_earned = 1; } }