client: Hide offers where coins are not enabled.

Better rate calculation.
This commit is contained in:
tecnovert
2021-02-15 23:49:18 +02:00
parent 5eb34a8c4b
commit 6516c6d138
3 changed files with 39 additions and 9 deletions

View File

@@ -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:

View File

@@ -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: