Skip to content

Commit 7b7cafa

Browse files
Merge pull request #263 from decentraland/feat/lands-price-bug
fix: incorrect trades usage in LANDs queries
2 parents cf6d352 + bbf324c commit 7b7cafa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ports/nfts/landQueries.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ function getAllLANDWheres(filters: GetNFTsFilters & { rentalAssetsIds?: string[]
4646
? SQL` (nft.owner_id = ${ownerEthereumAddress} OR nft.owner_id = ${ownerPolygonAddress}) `
4747
: null
4848
const FILTER_BY_MIN_PRICE = minPrice
49-
? SQL` (nft.search_order_price >= ${minPrice} OR (trades.assets -> 'received' ->> 'amount')::numeric(78) >= ${minPrice})`
49+
? SQL` (nft.search_order_price >= ${minPrice} OR (unified_trades.assets -> 'received' ->> 'amount')::numeric(78) >= ${minPrice})`
5050
: null
51-
const FILTER_BY_MIN_TRADE_PRICE = minPrice ? SQL` (trades.assets -> 'received' ->> 'amount')::numeric(78) >= ${minPrice}` : null
51+
const FILTER_BY_MIN_TRADE_PRICE = minPrice ? SQL` (unified_trades.assets -> 'received' ->> 'amount')::numeric(78) >= ${minPrice}` : null
5252
const FILTER_BY_MIN_ORDER_PRICE = minPrice ? SQL` nft.search_order_price >= ${minPrice}` : null
5353
const FILTER_BY_MAX_PRICE = maxPrice
54-
? SQL` (nft.search_order_price <= ${maxPrice} OR (trades.assets -> 'received' ->> 'amount')::numeric(78) <= ${maxPrice})`
54+
? SQL` (nft.search_order_price <= ${maxPrice} OR (unified_trades.assets -> 'received' ->> 'amount')::numeric(78) <= ${maxPrice})`
5555
: null
56-
const FILTER_BY_MAX_TRADE_PRICE = maxPrice ? SQL` (trades.assets -> 'received' ->> 'amount')::numeric(78) <= ${maxPrice}` : null
56+
const FILTER_BY_MAX_TRADE_PRICE = maxPrice ? SQL` (unified_trades.assets -> 'received' ->> 'amount')::numeric(78) <= ${maxPrice}` : null
5757
const FILTER_BY_MAX_ORDER_PRICE = maxPrice ? SQL` nft.search_order_price <= ${maxPrice}` : null
5858
const FILTER_BY_MIN_PLAZA_DISTANCE = minDistanceToPlaza ? SQL` search_distance_to_plaza >= ${minDistanceToPlaza} ` : null
5959
const FILTER_BY_MAX_PLAZA_DISTANCE = maxDistanceToPlaza ? SQL` search_distance_to_plaza <= ${maxDistanceToPlaza} ` : null

0 commit comments

Comments
 (0)