aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2012-12-10 17:06:50 -0800
committerAdam Soltys <[email protected]>2012-12-10 17:06:50 -0800
commit1387766f4fc1c9354730c07bebf0a9f013e4c6ac (patch)
tree06b682d2e0bb6d039eb64c4b3f17b6c0023e6b48
parenta9636a70389246a85c2df15cd0e1e441641c785a (diff)
downloadcoinos-server-1387766f4fc1c9354730c07bebf0a9f013e4c6ac.tar.gz
coinos-server-1387766f4fc1c9354730c07bebf0a9f013e4c6ac.zip
Check for transactions existence
-rw-r--r--public/js/report.coffee24
1 files changed, 21 insertions, 3 deletions
diff --git a/public/js/report.coffee b/public/js/report.coffee
index 28ec988b..225f4392 100644
--- a/public/js/report.coffee
+++ b/public/js/report.coffee
@@ -28,14 +28,32 @@ filterDates = ->
display = (transactions) ->
$('tbody tr').remove()
+ $('thead, tfoot').show()
+
+ if transactions.length is 0
+ $('tbody').append("""
+ <tr>
+ <td colspan='5'>
+ No transactions were found during the specified time period
+ </td>
+ </tr>
+ """)
+ $('thead, tfoot').hide()
+
$.each(transactions, ->
+ exchange = parseFloat(this.exchange)
+ received = parseFloat(this.received)
+ amount = received * exchange
+
+ return true unless !isNaN(parseFloat(amount)) && isFinite(amount)
+
$('tbody').append("""
<tr>
<td>#{this.date}</td>
<td>#{this.address}</td>
- <td>#{parseFloat(this.exchange).toFixed(2)}</td>
- <td>#{parseFloat(this.received).toFixed(2)}</td>
- <td>#{(this.received * this.exchange).toFixed(2)}</td>
+ <td>#{exchange.toFixed(2)}</td>
+ <td>#{received.toFixed(2)}</td>
+ <td>#{amount.toFixed(2)}</td>
</tr>
""")
)