mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-07 12:54:05 +02:00
fixed NaN issue in withdraw/charge
This commit is contained in:
parent
8f6776f3d0
commit
dbd3835dfb
2 changed files with 22 additions and 4 deletions
|
@ -100,8 +100,17 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function chargeCredit() {
|
function chargeCredit() {
|
||||||
var balance = shop.chargeCredit(amount, userdbid)
|
var balance=0
|
||||||
status_text.setStatus("Charged! "+username+"'s credit is "+balance+".", "#ffff7c")
|
if (!isNaN(amount)) {
|
||||||
|
if(amount>=0) {
|
||||||
|
balance = shop.chargeCredit(amount, userdbid)
|
||||||
|
status_text.setStatus("Charged "+amount+"! "+username+"'s credit is "+balance+".", "#ffff7c")
|
||||||
|
} else {
|
||||||
|
balance = shop.withdrawCredit((amount*(-1)), userdbid)
|
||||||
|
status_text.setStatus("Withdrawn "+amount+"! "+username+"'s credit is "+balance+".", "#ffff7c")
|
||||||
|
}
|
||||||
|
}
|
||||||
loadPage("MainPage")
|
loadPage("MainPage")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,17 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function withdrawCredit() {
|
function withdrawCredit() {
|
||||||
var balance = shop.withdrawCredit(amount, userdbid)
|
var balance=0
|
||||||
status_text.setStatus("Withdrawn! "+username+"'s credit is "+balance+".", "#ffff7c")
|
if (!isNaN(amount)) {
|
||||||
|
amount=(amount*1)
|
||||||
|
if(amount>=0) {
|
||||||
|
balance = shop.withdrawCredit(amount, userdbid)
|
||||||
|
status_text.setStatus("Withdrawn "+amount+"! "+username+"'s credit is "+balance+".", "#ffff7c")
|
||||||
|
} else {
|
||||||
|
balance = shop.chargeCredit((amount*(-1)),userdbid)
|
||||||
|
status_text.setStatus("Charged "+amount+"! "+username+"'s credit is "+balance+".", "#ffff7c")
|
||||||
|
}
|
||||||
|
}
|
||||||
loadPage("MainPage")
|
loadPage("MainPage")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue