mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
Fix random order matchmaking
This commit is contained in:
parent
f374b38660
commit
e4e7b031b4
@ -71,9 +71,9 @@ const MakerPage = ({
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<BookTable
|
||||
book={book}
|
||||
book={{ orders: matches, loading: book.loading }}
|
||||
maxWidth={Math.min(windowSize.width, 60)} // EM units
|
||||
maxHeight={Math.min(matches.length * 3.25 + 3.25, 16)} // EM units
|
||||
maxHeight={Math.min(matches.length * 3.25 + 3, 16)} // EM units
|
||||
defaultFullscreen={false}
|
||||
showControls={false}
|
||||
showFooter={false}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Order, Favorites } from '../models';
|
||||
import { PublicOrder, Favorites } from '../models';
|
||||
|
||||
interface AmountFilter {
|
||||
amount: string;
|
||||
@ -8,13 +8,13 @@ interface AmountFilter {
|
||||
}
|
||||
|
||||
interface FilterOrders {
|
||||
orders: Order[];
|
||||
orders: PublicOrder[];
|
||||
baseFilter: Favorites;
|
||||
amountFilter?: AmountFilter | null;
|
||||
paymentMethods?: string[];
|
||||
}
|
||||
|
||||
const filterByPayment = function (order: Order, paymentMethods: any[]) {
|
||||
const filterByPayment = function (order: PublicOrder, paymentMethods: any[]) {
|
||||
if (paymentMethods.length === 0) {
|
||||
return true;
|
||||
} else {
|
||||
@ -26,7 +26,7 @@ const filterByPayment = function (order: Order, paymentMethods: any[]) {
|
||||
}
|
||||
};
|
||||
|
||||
const filterByAmount = function (order: Order, filter: AmountFilter) {
|
||||
const filterByAmount = function (order: PublicOrder, filter: AmountFilter) {
|
||||
const filterMaxAmount =
|
||||
Number(filter.amount != '' ? filter.amount : filter.maxAmount) * (1 + filter.threshold);
|
||||
const filterMinAmount =
|
||||
@ -54,7 +54,6 @@ const filterOrders = function ({
|
||||
const paymentMethodChecks =
|
||||
paymentMethods.length > 0 ? filterByPayment(order, paymentMethods) : true;
|
||||
const amountChecks = amountFilter != null ? filterByAmount(order, amountFilter) : true;
|
||||
|
||||
return typeChecks && currencyChecks && paymentMethodChecks && amountChecks;
|
||||
});
|
||||
return filteredOrders;
|
||||
|
Loading…
Reference in New Issue
Block a user