diff --git a/web/app/stores/MarketsStore.js b/web/app/stores/MarketsStore.js index 926a0737b4..1d25f1a029 100644 --- a/web/app/stores/MarketsStore.js +++ b/web/app/stores/MarketsStore.js @@ -783,7 +783,7 @@ class MarketsStore { combinedBids.sort((a, b) => { return b.getPrice() - a.getPrice(); }).forEach(a => { - totalToReceive.plus(a.amountToReceive(false)); + totalToReceive.plus(a.amountToReceive(true)); totalForSale.plus(a.amountForSale()); a.setTotalForSale(totalForSale.clone()); @@ -804,7 +804,7 @@ class MarketsStore { return a.getPrice() - b.getPrice(); }).forEach(a => { totalForSale.plus(a.amountForSale()); - totalToReceive.plus(a.amountToReceive(true)); + totalToReceive.plus(a.amountToReceive(false)); a.setTotalForSale(totalForSale.clone()); a.setTotalToReceive(totalToReceive.clone()); }); diff --git a/web/test/marketTests.js b/web/test/marketTests.js index 95c44976fd..44d170c784 100644 --- a/web/test/marketTests.js +++ b/web/test/marketTests.js @@ -631,6 +631,24 @@ describe("LimitOrder", function() { ,"deferred_fee":14676 }; + const o5 = { + "id":"1.7.69372", + "expiration":"2017-12-13T14:14:09", + "seller":"1.2.132823", + "for_sale":1, + "sell_price": { + "base":{ + "amount": 6470, + "asset_id":"1.3.0" + }, + "quote": { + "amount":20113, + "asset_id":"1.3.121" + }, + } + ,"deferred_fee":14676 + }; + it("Instantiates", function() { let order = new LimitOrder(o, assets, "1.3.0"); assert(order.id === o.id); @@ -663,11 +681,13 @@ describe("LimitOrder", function() { let order4 = new LimitOrder(o4, assets, "1.3.121"); let order5 = new LimitOrder(o3, assets, "1.3.0"); let order6 = new LimitOrder(o4, assets, "1.3.0"); + let order7 = new LimitOrder(o5, assets, "1.3.121"); assert.equal(order3.amountToReceive().getAmount(), 3154, "As an ask, amountToReceive should equal 3154"); assert.equal(order4.amountToReceive().getAmount(), 1, "Order4 should equal 1"); assert.equal(order5.amountToReceive().getAmount(), 3155, "As a bid, amountToReceive should equal 3155"); assert.equal(order6.amountToReceive().getAmount(), 1, "Order6 should equal 1"); + assert.equal(order7.amountToReceive().getAmount(), 4, "Order7 should equal 4"); });