Fix random order matchmaking

This commit is contained in:
Reckless_Satoshi 2022-11-28 03:55:53 -08:00
parent f374b38660
commit e4e7b031b4
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 6 additions and 7 deletions

View File

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

View File

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