diff --git a/api/logics.py b/api/logics.py index 6ffc5c48..f5d2eb13 100644 --- a/api/logics.py +++ b/api/logics.py @@ -405,6 +405,7 @@ class Logics(): '''The order never shows up on the book and order status becomes "cancelled" ''' if order.status == Order.Status.WFB and order.maker == user: + cls.cancel_bond(order.maker_bond) order.status = Order.Status.UCA order.save() return True, None diff --git a/api/models.py b/api/models.py index 21766374..13799007 100644 --- a/api/models.py +++ b/api/models.py @@ -24,7 +24,7 @@ class Currency(models.Model): currency_choices = [(int(val), label) for val, label in list(currency_dict.items())] currency = models.PositiveSmallIntegerField(choices=currency_choices, null=False, unique=True) - exchange_rate = models.DecimalField(max_digits=20, decimal_places=8, default=None, null=True, validators=[MinValueValidator(0)]) + exchange_rate = models.DecimalField(max_digits=14, decimal_places=4, default=None, null=True, validators=[MinValueValidator(0)]) timestamp = models.DateTimeField(auto_now_add=True) def __str__(self): diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js index 1dc9572a..1930fca3 100644 --- a/frontend/src/components/BookPage.js +++ b/frontend/src/components/BookPage.js @@ -67,7 +67,9 @@ export default class BookPage extends Component { // pretty numbers pn(x) { - return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + var parts = x.toString().split("."); + parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); + return parts.join("."); } // Colors for the status badges @@ -88,7 +90,7 @@ export default class BookPage extends Component { robot: order.maker_nick, robot_status: order.maker_status, type: order.type ? "Seller": "Buyer", - amount: parseFloat(parseFloat(order.amount).toFixed(4)), + amount: parseFloat(parseFloat(order.amount).toFixed(5)), currency: this.getCurrencyCode(order.currency), payment_method: order.payment_method, price: order.price, @@ -121,10 +123,13 @@ export default class BookPage extends Component { ); } }, { field: 'type', headerName: 'Is', width: 60 }, - { field: 'amount', headerName: 'Amount', type: 'number', width: 80 }, + { field: 'amount', headerName: 'Amount', type: 'number', width: 80, + renderCell: (params) => {return ( +