-
Notifications
You must be signed in to change notification settings - Fork 494
[FIX] Advanced trade: fix values calculations #2417
[FIX] Advanced trade: fix values calculations #2417
Conversation
@geertweening @clark800 do you guys know what needs to be fixed? |
He's referring to this pull request: XRPLF/xrpl.js#326 |
@vhpoet just come to my mind - why to_text_full was used here in the first place? |
Do not convert amount and order values to number when assigning to input - because chrome and IE shows big/small numbers in input in scientific notation use "replace(/,/g, '')" on result of "to_text_full()" until ripple lib fixed - "to_text_full()" returns string with group separator
7c5ec25
to
a49edc3
Compare
@@ -834,7 +836,7 @@ TradeTab.prototype.angular = function(module) | |||
if (order.price_amount && order.price_amount.is_valid() && | |||
order.first_amount && order.first_amount.is_valid()) { | |||
order.second_amount = order.price_amount.product_human(order.first_amount); | |||
order.second = +order.second_amount.to_human({group_sep: false}); | |||
order.second = order.second_amount.to_human({group_sep: false}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was the +
killed? It's a conversion to number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jublo That was whole point of this commit. This value goes into input field. And when it is number, chrome shows it in e-notation if it too small or too big
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. Well done then.
LGTM |
1 similar comment
LGTM |
[FIX] Advanced trade: fix values calculations
Do not convert amount and order values to number
when assigning to input - because chrome and IE shows
big/small numbers in input in scientific notation
use "replace(/,/g, '')" on result of "to_text_full()"
until ripple lib fixed - "to_text_full()" returns
string with group separator