mirror of
https://github.com/Blockstream/satellite-api.git
synced 2025-02-22 13:42:33 +01:00
Do not round the order's bid_per_byte value
Store the fractional value on the db. Let the frontend round if necessary but keep it non-rounded on the backend.
This commit is contained in:
parent
1568ee54f2
commit
24a4c5ccb7
2 changed files with 2 additions and 3 deletions
|
@ -39,8 +39,7 @@ def _unpaid_invoices_total(order):
|
|||
|
||||
def adjust_bids(order):
|
||||
order.bid = _paid_invoices_total(order)
|
||||
order.bid_per_byte = round(
|
||||
order.bid / calc_ota_msg_len(order.message_size), 2)
|
||||
order.bid_per_byte = order.bid / calc_ota_msg_len(order.message_size)
|
||||
order.unpaid_bid = _unpaid_invoices_total(order)
|
||||
db.session.commit()
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ def test_adjust_bids(client):
|
|||
assert order.bid == paid_bid
|
||||
assert order.unpaid_bid == unpaid_bid
|
||||
expected_bid_per_byte = paid_bid / (n_bytes + 52) # w/ 52 overhead bytes
|
||||
assert order.bid_per_byte == round(expected_bid_per_byte, 2)
|
||||
assert order.bid_per_byte == expected_bid_per_byte
|
||||
|
||||
|
||||
@patch('orders.new_invoice')
|
||||
|
|
Loading…
Add table
Reference in a new issue