Skip to content

Commit ecf69bb

Browse files
fix NaN
1 parent f89f389 commit ecf69bb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/javascript/binary/websocket_pages/trade/beta/purchase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var Purchase_Beta = (function () {
4949
message_container.show();
5050
confirmation_error.hide();
5151

52-
$('#contract-values > div > div').each(function() {
52+
$('#contract-values td').each(function() {
5353
$(this).text('').removeAttr('class', '');
5454
});
5555
brief.textContent = $('#underlying option:selected').text() + ' / ' +

src/javascript/binary/websocket_pages/trade/common.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ function reloadPage(){
883883
}
884884

885885
function addComma(num, decimal_points){
886-
num = (num || 0) * 1;
886+
num = String(num || 0).replace(/,/g, '') * 1;
887887
return num.toFixed(decimal_points || 2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
888888
}
889889

@@ -963,7 +963,8 @@ function updatePurchaseStatus_Beta(final_price, pnl, contract_status){
963963

964964
var isWin = (+final_price > 0);
965965
$('#contract_purchase_profit_value').attr('class', (isWin ? 'profit' : 'loss'));
966-
label_value(profit, isWin ? Content.localize().textProfit : Content.localize().textLoss, addComma(Math.round((final_price - pnl) * 100) / 100));
966+
label_value(profit, isWin ? Content.localize().textProfit : Content.localize().textLoss,
967+
addComma(isWin ? Math.round((final_price - pnl) * 100) / 100 : - Math.abs(pnl)));
967968
}
968969

969970
function displayTooltip_Beta(market, symbol){

0 commit comments

Comments
 (0)