Skip to content

Commit 4f77191

Browse files
author
LocalIdentity
committed
Fix search for item code
The trade site uses floats for the weights internally when sorting but only shows integers to the site and api Need to use +-1 so that it doesn't accidently miss an item e.g. before a weight of 100.3 would show as 100 in the api callback and then we'd search for 99.9 - 100.1 so the search would never show the item
1 parent 41b1324 commit 4f77191

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/Classes/TradeQuery.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,12 +1176,11 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
11761176
else
11771177
local exactQuery = dkjson.decode(self.lastQuery)
11781178
-- use trade sum to get the specific item. both min and max
1179-
-- weight fields seem to be inconsistent. making the minimum
1180-
-- e.g. exactly 172.3 as on the result item does not always work
1181-
exactQuery.query.stats[1].value = { min = floor(itemResult.weight, 1) - 0.1, max = round(itemResult.weight, 1) + 0.1 }
1179+
-- weight on site uses floats but only shows integer in the api
1180+
-- e.g. weight of 172.3 shows up as 172 in the api
1181+
exactQuery.query.stats[1].value = { min = floor(itemResult.weight, 1) - 1, max = round(itemResult.weight, 1) + 1 }
11821182
-- also apply trader name. this should make false positives
1183-
-- extremely unlikely. this doesn't seem to take up a filter
1184-
-- slot
1183+
-- extremely unlikely. this doesn't seem to take up a filter slot
11851184
exactQuery.query.filters.trade_filters = { filters = { account = itemResult.trader } }
11861185

11871186
local exactQueryStr = dkjson.encode(exactQuery)

0 commit comments

Comments
 (0)