working on optimizations
This commit is contained in:
+1
-1
@@ -197,7 +197,7 @@ local methods = {
|
|||||||
GetRecordPercent = function(self, record)
|
GetRecordPercent = function(self, record)
|
||||||
if not record then return end
|
if not record then return end
|
||||||
-- cache the market value on the record
|
-- cache the market value on the record
|
||||||
record.historical_value = record.market_value or Aux.history.value(record.item_key) or 0
|
record.historical_value = record.historical_value or Aux.history.value(record.item_key) or 0
|
||||||
if record.historical_value > 0 then
|
if record.historical_value > 0 then
|
||||||
if record.unit_buyout_price > 0 then
|
if record.unit_buyout_price > 0 then
|
||||||
return Aux.round(100 * record.unit_buyout_price / record.historical_value, 1)
|
return Aux.round(100 * record.unit_buyout_price / record.historical_value, 1)
|
||||||
|
|||||||
+20
-2
@@ -4,7 +4,7 @@ Aux.history = public
|
|||||||
function private.next_push()
|
function private.next_push()
|
||||||
local date = date('*t')
|
local date = date('*t')
|
||||||
date.hour, date.min, date.sec = 24, 0, 0
|
date.hour, date.min, date.sec = 24, 0, 0
|
||||||
return time()
|
return time(date)
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.new_record()
|
function private.new_record()
|
||||||
@@ -17,6 +17,25 @@ function private.load_data()
|
|||||||
return dataset.history
|
return dataset.history
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function public.test()
|
||||||
|
local data = private.load_data()
|
||||||
|
for key, _ in data do
|
||||||
|
local record = private.read_record(key)
|
||||||
|
record.next_push = 0
|
||||||
|
private.write_record(key, record)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function public.test2()
|
||||||
|
local data = private.load_data()
|
||||||
|
for key, _ in data do
|
||||||
|
data[key] = data[key]..'5000@5000'
|
||||||
|
for i=1,100 do
|
||||||
|
data[key] = data[key]..';9999@9995'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function private.read_record(item_key)
|
function private.read_record(item_key)
|
||||||
local data = private.load_data()
|
local data = private.load_data()
|
||||||
|
|
||||||
@@ -57,7 +76,6 @@ function private.write_record(item_key, record)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function public.process_auction(auction_record)
|
function public.process_auction(auction_record)
|
||||||
|
|
||||||
local item_record = private.read_record(auction_record.item_key)
|
local item_record = private.read_record(auction_record.item_key)
|
||||||
|
|
||||||
local unit_bid_price = ceil(auction_record.bid_price / auction_record.aux_quantity)
|
local unit_bid_price = ceil(auction_record.bid_price / auction_record.aux_quantity)
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ function private.scan_auctions_helper(i, n, k)
|
|||||||
Aux.history.process_auction(auction_info)
|
Aux.history.process_auction(auction_info)
|
||||||
|
|
||||||
if not private.current_query().validator or private.current_query().validator(auction_info) then
|
if not private.current_query().validator or private.current_query().validator(auction_info) then
|
||||||
return private.wait_for_callback{private.current_thread().params.on_read_auction or Aux.util.pass, auction_info, recurse }
|
return private.wait_for_callback{private.current_thread().params.on_read_auction or Aux.util.pass, auction_info, recurse}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user