mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-23 01:03:23 -05:00
Corrects an introduced bug where max is assigned a value, but obj.volunteer does not have a value assigned, yet.
This commit is contained in:
parent
165b81adc5
commit
27ff8f87d2
@ -630,12 +630,15 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var year = d.getFullYear();
|
var year = d.getFullYear();
|
||||||
|
|
||||||
|
/*
|
||||||
var vhr = obj.volunteer_hour_value * volunteer[year].volunteer_hours_redeemed;
|
var vhr = obj.volunteer_hour_value * volunteer[year].volunteer_hours_redeemed;
|
||||||
var remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed;
|
var remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed;
|
||||||
var exceeded_sweat_equity_limit = false;
|
var exceeded_sweat_equity_limit = false;
|
||||||
if (vhr > obj.sweat_equity_limit) {
|
if (vhr > obj.sweat_equity_limit) {
|
||||||
exceeded_sweat_equity_limit = true;
|
exceeded_sweat_equity_limit = true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// no volunteer_hours_redeemed or still less than the allowable sweat_equity_hours
|
// no volunteer_hours_redeemed or still less than the allowable sweat_equity_hours
|
||||||
/* if (isNaN(sweat_equity_hours) || volunteer_hours_redeemed < sweat_equity_hours) { */
|
/* if (isNaN(sweat_equity_hours) || volunteer_hours_redeemed < sweat_equity_hours) { */
|
||||||
@ -653,7 +656,7 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// discount is now applied if transaction is over special_volunteer_hours_qualification
|
// discount is now applied if transaction is over special_volunteer_hours_qualification
|
||||||
if (sweat_equity_limit > obj.sweat_equity_limit || exceeded_sweat_equity_limit === true) {
|
if (redeemable_value > obj.sweat_equity_limit) {
|
||||||
|
|
||||||
|
|
||||||
var value_to_apply_discount, difference, hours_applied_with_value;
|
var value_to_apply_discount, difference, hours_applied_with_value;
|
||||||
@ -662,11 +665,7 @@ $(function() {
|
|||||||
// are maxable redeemable hours less than price
|
// are maxable redeemable hours less than price
|
||||||
var max_discount_price;
|
var max_discount_price;
|
||||||
if ($("#transaction_type").val() !== "Stand Time") {
|
if ($("#transaction_type").val() !== "Stand Time") {
|
||||||
if (exceeded_sweat_equity_limit === true) {
|
|
||||||
max_discount_price = remaining * obj.volunteer_hour_value;
|
|
||||||
} else {
|
|
||||||
max_discount_price = obj.current_year_volunteer_hours * obj.volunteer_hour_value;
|
max_discount_price = obj.current_year_volunteer_hours * obj.volunteer_hour_value;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
max_discount_price = obj.stand_time_value * obj.volunteer_hour_value;
|
max_discount_price = obj.stand_time_value * obj.volunteer_hour_value;
|
||||||
}
|
}
|
||||||
@ -676,7 +675,7 @@ $(function() {
|
|||||||
if (price > max_discount_price) {
|
if (price > max_discount_price) {
|
||||||
max_discount_price_difference = price - max_discount_price;
|
max_discount_price_difference = price - max_discount_price;
|
||||||
console.log("we have to do things differently " + max_discount_price_difference);
|
console.log("we have to do things differently " + max_discount_price_difference);
|
||||||
value_to_apply_discount = (price - max_discount_price_difference) - sweat_equity_limit;
|
value_to_apply_discount = (price - max_discount_price_difference) - redeemable_value;
|
||||||
difference = (price - max_discount_price_difference) - obj.sweat_equity_limit;
|
difference = (price - max_discount_price_difference) - obj.sweat_equity_limit;
|
||||||
hours_applied_with_value = difference - value_to_apply_discount;
|
hours_applied_with_value = difference - value_to_apply_discount;
|
||||||
|
|
||||||
@ -685,7 +684,7 @@ $(function() {
|
|||||||
(hours_applied_with_value * (discount / 100).toFixed(2));
|
(hours_applied_with_value * (discount / 100).toFixed(2));
|
||||||
} else {
|
} else {
|
||||||
difference = price - obj.sweat_equity_limit;
|
difference = price - obj.sweat_equity_limit;
|
||||||
value_to_apply_discount = price - sweat_equity_limit;
|
value_to_apply_discount = price - redeemable_value;
|
||||||
hours_applied_with_value = difference - value_to_apply_discount;
|
hours_applied_with_value = difference - value_to_apply_discount;
|
||||||
|
|
||||||
console.log(difference + " - (" + hours_applied_with_value + " * ." + discount + ")");
|
console.log(difference + " - (" + hours_applied_with_value + " * ." + discount + ")");
|
||||||
@ -910,7 +909,7 @@ $(function() {
|
|||||||
if ((volunteer_hours && volunteer_hours.length)) {
|
if ((volunteer_hours && volunteer_hours.length)) {
|
||||||
|
|
||||||
var max;
|
var max;
|
||||||
if (remaining || remaining === 0) {
|
if ((remaining || remaining === 0) && obj.volunteer) {
|
||||||
max = remaining;
|
max = remaining;
|
||||||
} else {
|
} else {
|
||||||
max = obj.current_year_volunteer_hours;
|
max = obj.current_year_volunteer_hours;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user