mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
client: Hide offers where coins are not enabled.
Better rate calculation.
This commit is contained in:
@@ -5134,6 +5134,12 @@ class BasicSwap(BaseApp):
|
||||
if offset is not None:
|
||||
q = q.offset(offset)
|
||||
for row in q:
|
||||
# Show offers for enabled coins only
|
||||
try:
|
||||
ci_from = self.ci(row.coin_from)
|
||||
ci_to = self.ci(row.coin_to)
|
||||
except Exception as e:
|
||||
continue
|
||||
rv.append(row)
|
||||
return rv
|
||||
finally:
|
||||
|
||||
@@ -447,7 +447,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||
errors.append('Amount To')
|
||||
|
||||
if 'amt_to' in parsed_data and 'amt_from' in parsed_data:
|
||||
parsed_data['rate'] = int((parsed_data['amt_to'] / parsed_data['amt_from']) * ci_from.COIN())
|
||||
parsed_data['rate'] = ci_from.make_int(parsed_data['amt_to'] / parsed_data['amt_from'], r=1)
|
||||
|
||||
if b'step1' in form_data:
|
||||
if len(errors) == 0 and b'continue' in form_data:
|
||||
|
||||
Reference in New Issue
Block a user