Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Coinnext/coinnext
Browse files Browse the repository at this point in the history
  • Loading branch information
doomhz committed Jun 12, 2014
2 parents d59dcec + 07bb5e7 commit 9dbc0a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
9 changes: 4 additions & 5 deletions assets/js/app/collections/order_logs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ class window.App.OrderLogsCollection extends Backbone.Collection
_.str.satoshiRound total

calculateVolumeForPriceLimit: (unitPrice)->
unitPrice = _.str.satoshiRound(unitPrice)
totalAmount = 0
reachedTheUnitPrice = false
unitPrice = _.str.satoshiRound unitPrice
@each (order)->
return if reachedTheUnitPrice and unitPrice isnt _.str.satoshiRound(order.get("unit_price"))
reachedTheUnitPrice = true if unitPrice is _.str.satoshiRound(order.get("unit_price"))
totalAmount = App.math.add(totalAmount, order.calculateFirstNoFeeAmount())
orderPrice = _.str.satoshiRound(order.get("unit_price"))
totalAmount = App.math.add(totalAmount, order.calculateFirstNoFeeAmount()) if orderPrice <= unitPrice
return if orderPrice > unitPrice
_.str.satoshiRound totalAmount
8 changes: 4 additions & 4 deletions assets/js/app/collections/orders.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class window.App.OrdersCollection extends Backbone.Collection
_.str.satoshiRound total

calculateVolumeForPriceLimit: (unitPrice)->
unitPrice = _.str.satoshiRound(unitPrice)
totalAmount = 0
reachedTheUnitPrice = false
@each (order)->
return if reachedTheUnitPrice and unitPrice isnt _.str.satoshiRound(order.get("unit_price"))
reachedTheUnitPrice = true if unitPrice is _.str.satoshiRound(order.get("unit_price"))
totalAmount = App.math.add(totalAmount, order.calculateFirstNoFeeAmount())
orderPrice = _.str.satoshiRound(order.get("unit_price"))
totalAmount = App.math.add(totalAmount, order.calculateFirstNoFeeAmount()) if orderPrice <= unitPrice
return if orderPrice > unitPrice
_.str.satoshiRound totalAmount

getStacked: ()->
Expand Down
6 changes: 3 additions & 3 deletions assets/js/app/views/order_book.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class App.OrderBookView extends App.MasterView

onOrderClick: (ev)->
$row = $(ev.currentTarget)
unitPrice = $row.data "unit-price"
unitPrice = parseFloat $row.data "unit-price"
action = $row.data "action"
order = new App.OrderModel
unit_price: _.str.toFixed unitPrice
unit_price: unitPrice
action: action
amount: _.str.toFixed @collection.calculateVolumeForPriceLimit unitPrice
amount: @collection.calculateVolumeForPriceLimit unitPrice
$.publish "order-book-order-selected", order

0 comments on commit 9dbc0a7

Please sign in to comment.