aboutsummaryrefslogtreecommitdiffstats
path: root/public/js/calculator.coffee
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2016-02-04 22:06:28 -0800
committerAdam Soltys <[email protected]>2016-02-04 22:06:28 -0800
commit083f14611eba89b47f681454509b0185e7deaa99 (patch)
tree4af93db7a4109fef33ac60023a12357513c8c73e /public/js/calculator.coffee
parentff5cbf6f07b664d681bbc97820e3e8c2cfede860 (diff)
downloadcoinos-server-083f14611eba89b47f681454509b0185e7deaa99.tar.gz
coinos-server-083f14611eba89b47f681454509b0185e7deaa99.zip
Prevent duplicate transaction logging
Diffstat (limited to 'public/js/calculator.coffee')
-rw-r--r--public/js/calculator.coffee17
1 files changed, 10 insertions, 7 deletions
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee
index 9583a018..407a80f5 100644
--- a/public/js/calculator.coffee
+++ b/public/js/calculator.coffee
@@ -8,6 +8,7 @@ g = exports ? this
g.errors = []
g.amount_requested = 0
g.tip = 1
+g.transactions = []
$(->
$.ajax(
@@ -147,13 +148,15 @@ logTransaction = (txid, amount) ->
$('#success')[0].play()
g.user.index++
- $.post("/#{g.user.username}/transactions",
- txid: txid,
- address: g.user.address,
- date: moment().format("YYYY-MM-DD HH:mm:ss"),
- received: amount,
- exchange: g.exchange
- )
+ if g.transactions.indexOf(txid) is -1
+ g.transactions.push(txid)
+ $.post("/#{g.user.username}/transactions",
+ txid: txid,
+ address: g.user.address,
+ date: moment().format("YYYY-MM-DD HH:mm:ss"),
+ received: amount,
+ exchange: g.exchange
+ )
getAddress()