diff options
| author | Adam Soltys <[email protected]> | 2016-02-04 22:06:28 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2016-02-04 22:06:28 -0800 |
| commit | 083f14611eba89b47f681454509b0185e7deaa99 (patch) | |
| tree | 4af93db7a4109fef33ac60023a12357513c8c73e /public/js/calculator.coffee | |
| parent | ff5cbf6f07b664d681bbc97820e3e8c2cfede860 (diff) | |
| download | coinos-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.coffee | 17 |
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() |
