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