mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-23 01:03:23 -05:00
Improves the max bike earned logic.
This commit is contained in:
parent
e852af5e5f
commit
aab521eb6b
@ -861,7 +861,8 @@ $(function() {
|
|||||||
}); // stand time pos
|
}); // stand time pos
|
||||||
}
|
}
|
||||||
|
|
||||||
// How many hours does this volunteer have?
|
// How many hours does this volunteer have?
|
||||||
|
$("#redeemable_hours").val("");
|
||||||
$.post("json/transaction.php", { volunteer_benefits: 1, contact_id: this.value }, function (data) {
|
$.post("json/transaction.php", { volunteer_benefits: 1, contact_id: this.value }, function (data) {
|
||||||
|
|
||||||
var year = d.getFullYear();
|
var year = d.getFullYear();
|
||||||
@ -1057,13 +1058,18 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't require paid to be selected, only amount >= 0
|
// Don't require paid to be selected, only amount >= 0
|
||||||
var max_bike_earned = 0;
|
var max_bike_earned = 0, maximum_allowable_earned_bikes;
|
||||||
if ($("#trans_type_info").text() === "Bicycles") {
|
if ($("#trans_type_info").text() === "Bicycles") {
|
||||||
// hours were redeemed and this is a Bicycle transaction
|
// hours were redeemed and this is a Bicycle transaction
|
||||||
if (vhr !== "0.00") {
|
if (vhr !== "0.00") {
|
||||||
max_bike_earned = 1;
|
max_bike_earned = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.post("json/transaction.php",{ max_bike_earned: 1 }, function(data) {
|
||||||
|
var obj = $.parseJSON(data);
|
||||||
|
maximum_allowable_earned_bikes = obj.max_bike_earned;
|
||||||
|
});
|
||||||
|
|
||||||
volunteer_benefits_history[year] = {
|
volunteer_benefits_history[year] = {
|
||||||
volunteer_hours_redeemed: vhr,
|
volunteer_hours_redeemed: vhr,
|
||||||
@ -1098,9 +1104,11 @@ $(function() {
|
|||||||
if ($("#redeemable_hours").val().length) {
|
if ($("#redeemable_hours").val().length) {
|
||||||
volunteer_benefits_history[year].volunteer_hours_redeemed = parseFloat(volunteer_benefits_history[year].volunteer_hours_redeemed) +
|
volunteer_benefits_history[year].volunteer_hours_redeemed = parseFloat(volunteer_benefits_history[year].volunteer_hours_redeemed) +
|
||||||
parseFloat($("#redeemable_hours").val());
|
parseFloat($("#redeemable_hours").val());
|
||||||
|
|
||||||
volunteer_benefits_history[year].max_bike_earned = parseFloat(volunteer_benefits_history[year].max_bike_earned) +
|
if (parseFloat(volunteer_benefits_history[year].max_bike_earned) < maximum_allowable_earned_bikes) {
|
||||||
max_bike_earned;
|
volunteer_benefits_history[year].max_bike_earned = parseFloat(volunteer_benefits_history[year].max_bike_earned) +
|
||||||
|
max_bike_earned;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user