Browse Source

Fixes #57, happy New Years!

devel
Jonathan Rosenbaum 7 years ago
parent
commit
8ffb51e20a
  1. 8
      js/transaction.js

8
js/transaction.js

@ -688,6 +688,9 @@ $(function() {
// figure out remaining hours that can be redeemed if some, but not all, volunteer hours have been redeemed. // figure out remaining hours that can be redeemed if some, but not all, volunteer hours have been redeemed.
var remaining, year = d.getFullYear(), exceeded_sweat_equity_limit = false, price_after_redeeming, spinner_difference; var remaining, year = d.getFullYear(), exceeded_sweat_equity_limit = false, price_after_redeeming, spinner_difference;
if (volunteer) { if (volunteer) {
// will need to figure out these values when there isn't a property for the new year
if (volunteer.hasOwnProperty(year)) {
var vhr = obj.volunteer_hour_value * volunteer[year].volunteer_hours_redeemed + (spinner_value * obj.volunteer_hour_value); var vhr = obj.volunteer_hour_value * volunteer[year].volunteer_hours_redeemed + (spinner_value * obj.volunteer_hour_value);
//console.log(obj.volunteer_hour_value + " * " + volunteer[year].volunteer_hours_redeemed + " = " + vhr ); //console.log(obj.volunteer_hour_value + " * " + volunteer[year].volunteer_hours_redeemed + " = " + vhr );
remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed; remaining = obj.current_year_volunteer_hours - volunteer[year].volunteer_hours_redeemed;
@ -699,7 +702,7 @@ $(function() {
//console.log(spinner_difference + " " + price_after_redeeming); //console.log(spinner_difference + " " + price_after_redeeming);
} }
} }
}
// 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
@ -755,6 +758,7 @@ $(function() {
} }
//console.log(price_after_redeeming + " - " + redeemable_value + " * ." + discount); //console.log(price_after_redeeming + " - " + redeemable_value + " * ." + discount);
} else { } else {
// Never redeemed before
amount.val(price - redeemable_value); amount.val(price - redeemable_value);
} }
} }
@ -1179,7 +1183,7 @@ $(function() {
if ((volunteer_hours && volunteer_hours.length)) { if ((volunteer_hours && volunteer_hours.length)) {
var max; var max;
if ((remaining || remaining === 0) && obj.volunteer) { if ((remaining || remaining === 0) && (obj.volunteer && volunteer.hasOwnProperty(year))) {
max = remaining; max = remaining;
} else { } else {
max = obj.current_year_volunteer_hours; max = obj.current_year_volunteer_hours;

Loading…
Cancel
Save