performance improvements
This commit is contained in:
+13
-7
@@ -677,33 +677,39 @@ local methods = {
|
||||
-- ============================================================================
|
||||
|
||||
UpdateRowInfo = function(self)
|
||||
for _, info in self.rowInfo do
|
||||
if type(info) == 'table' then
|
||||
for _, child in info.children do release(child) end
|
||||
release(info.children)
|
||||
release(info)
|
||||
end
|
||||
end
|
||||
wipe(self.rowInfo)
|
||||
self.rowInfo.numDisplayRows = 0
|
||||
self.isSorted = nil
|
||||
self:SetSelectedRecord(nil, true)
|
||||
|
||||
sort(self.records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
||||
|
||||
local records = self.records
|
||||
if getn(records) == 0 then return end
|
||||
local records = self.records
|
||||
if getn(records) == 0 then return end
|
||||
sort(records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
||||
|
||||
-- Populate the row info from the database by combining identical auctions and auctions
|
||||
-- of the same base item. Also, get the number of rows which will be shown.
|
||||
for i = 1, getn(records) do
|
||||
local record = records[i]
|
||||
local prevRecord = records[i-1]
|
||||
local prevRecord = records[i - 1]
|
||||
if prevRecord and record.search_signature == prevRecord.search_signature then
|
||||
-- it's an identical auction to the previous row so increment the number of auctions
|
||||
self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions = self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions + 1
|
||||
elseif prevRecord and record.item_key == prevRecord.item_key then
|
||||
-- it's the same base item as the previous row so insert a new auction
|
||||
tinsert(self.rowInfo[getn(self.rowInfo)].children, {numAuctions=1, record=record})
|
||||
tinsert(self.rowInfo[getn(self.rowInfo)].children, T('numAuctions', 1, 'record', record))
|
||||
if self.expanded[self.rowInfo[getn(self.rowInfo)].expandKey] then
|
||||
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
|
||||
end
|
||||
else
|
||||
-- it's a different base item from the previous row
|
||||
tinsert(self.rowInfo, {item_key=record.item_key, expandKey=record.item_key, children={{numAuctions=1, record=record}}})
|
||||
tinsert(self.rowInfo, T('item_key', record.item_key, 'expandKey', record.item_key, 'children', A(T('numAuctions', 1, 'record', record))))
|
||||
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
|
||||
end
|
||||
end
|
||||
|
||||
+6
-6
@@ -144,18 +144,18 @@ function update_auction_listing()
|
||||
buyout_color = inline_color.yellow
|
||||
end
|
||||
|
||||
tinsert(auction_rows, {
|
||||
cols = {
|
||||
tinsert(auction_rows, T(
|
||||
'cols', A(
|
||||
{value=auction_record.own and color.yellow(auction_record.count) or auction_record.count},
|
||||
{value=al.time_left(auction_record.duration)},
|
||||
{value=auction_record.stack_size == stack_size and color.yellow(auction_record.stack_size) or auction_record.stack_size},
|
||||
{value=money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color)},
|
||||
{value=historical_value and al.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
|
||||
{value=auction_record.unit_buyout_price > 0 and money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
|
||||
{value=auction_record.unit_buyout_price > 0 and historical_value and al.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'},
|
||||
},
|
||||
record = auction_record,
|
||||
})
|
||||
{value=auction_record.unit_buyout_price > 0 and historical_value and al.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'}
|
||||
),
|
||||
'record', auction_record
|
||||
))
|
||||
end
|
||||
sort(auction_rows, function(a, b)
|
||||
return sort_util.multi_lt(
|
||||
|
||||
+19
-19
@@ -10,42 +10,42 @@ function update_search_listings()
|
||||
local autobuy_filter_rows = t
|
||||
for i, autobuy_filter in aux_auto_buy_filters do
|
||||
local name = strsub(autobuy_filter.prettified, 1, 250)
|
||||
tinsert(autobuy_filter_rows, {
|
||||
cols = {{value=name}},
|
||||
search = autobuy_filter,
|
||||
index = i,
|
||||
})
|
||||
tinsert(autobuy_filter_rows, T(
|
||||
'cols', A(T('value', name)),
|
||||
'search', autobuy_filter,
|
||||
'index', i
|
||||
))
|
||||
end
|
||||
auto_buy_listing:SetData(autobuy_filter_rows)
|
||||
|
||||
local favorite_search_rows = t
|
||||
for i, favorite_search in aux_favorite_searches do
|
||||
local name = strsub(favorite_search.prettified, 1, 250)
|
||||
tinsert(favorite_search_rows, {
|
||||
cols = {{value=name}},
|
||||
search = favorite_search,
|
||||
index = i,
|
||||
})
|
||||
tinsert(favorite_search_rows, T(
|
||||
'cols', A(T('value', name)),
|
||||
'search', favorite_search,
|
||||
'index', i
|
||||
))
|
||||
end
|
||||
favorite_searches_listing:SetData(favorite_search_rows)
|
||||
|
||||
local recent_search_rows = t
|
||||
for i, recent_search in aux_recent_searches do
|
||||
local name = strsub(recent_search.prettified, 1, 250)
|
||||
tinsert(recent_search_rows, {
|
||||
cols = {{value=name}},
|
||||
search = recent_search,
|
||||
index = i,
|
||||
})
|
||||
tinsert(recent_search_rows, T(
|
||||
'cols', A(T('value', name)),
|
||||
'search', recent_search,
|
||||
'index', i
|
||||
))
|
||||
end
|
||||
recent_searches_listing:SetData(recent_search_rows)
|
||||
end
|
||||
|
||||
function new_recent_search(filter_string, prettified)
|
||||
tinsert(aux_recent_searches, 1, {
|
||||
filter_string = filter_string,
|
||||
prettified = prettified,
|
||||
})
|
||||
tinsert(aux_recent_searches, 1, T(
|
||||
'filter_string', filter_string,
|
||||
'prettified', prettified
|
||||
))
|
||||
while getn(aux_recent_searches) > 50 do
|
||||
tremove(aux_recent_searches)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user