updating historical value after post scan
This commit is contained in:
+3
-3
@@ -88,7 +88,7 @@ function public.value(item_key)
|
|||||||
local weighted_values = {}
|
local weighted_values = {}
|
||||||
local total_weight = 0
|
local total_weight = 0
|
||||||
for _, data_point in item_record.data_points do
|
for _, data_point in item_record.data_points do
|
||||||
local weight = 0.95^Aux.round((data_point.time - item_record.data_points[1].time)/(60*60*24))
|
local weight = 0.95^Aux.round((data_point.time - item_record.data_points[1].time) / (60*60*24))
|
||||||
total_weight = total_weight + weight
|
total_weight = total_weight + weight
|
||||||
tinsert(weighted_values, {value = data_point.market_value, weight = weight})
|
tinsert(weighted_values, {value = data_point.market_value, weight = weight})
|
||||||
end
|
end
|
||||||
@@ -97,8 +97,8 @@ function public.value(item_key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
value = private.weighted_median(weighted_values)
|
value = private.weighted_median(weighted_values)
|
||||||
-- not seen in the last week or not ignoring at least two high and low outliers
|
-- not seen at least 3 times in the last two weeks or not ignoring at least two high and low outliers
|
||||||
unreliable = item_record.data_points[1].time < time() - 60 * 60 * 24 * 7 or not weighted_values[2] or weighted_values[1].weight + weighted_values[2].weight >= 0.5
|
unreliable = not weighted_values[3] or item_record.data_points[3].time < time() - 60*60*24*7*2 or weighted_values[1].weight + weighted_values[2].weight >= 0.5
|
||||||
else
|
else
|
||||||
value = private.market_value(item_record)
|
value = private.market_value(item_record)
|
||||||
unreliable = true
|
unreliable = true
|
||||||
|
|||||||
+9
-3
@@ -799,6 +799,12 @@ function private.unit_vendor_price(item_key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function private.update_historical_value_button()
|
||||||
|
local historical_value = Aux.history.value(selected_item.key)
|
||||||
|
private.historical_value_button.amount = historical_value
|
||||||
|
private.historical_value_button:SetText(Aux.money.to_string(historical_value or 0, true, nil, 3))
|
||||||
|
end
|
||||||
|
|
||||||
function private.set_item(item)
|
function private.set_item(item)
|
||||||
local settings = private.read_settings(item.key)
|
local settings = private.read_settings(item.key)
|
||||||
|
|
||||||
@@ -831,9 +837,7 @@ function private.set_item(item)
|
|||||||
private.set_unit_start_price(settings.start_price)
|
private.set_unit_start_price(settings.start_price)
|
||||||
private.set_unit_buyout_price(settings.buyout_price)
|
private.set_unit_buyout_price(settings.buyout_price)
|
||||||
|
|
||||||
local historical_value = Aux.history.value(selected_item.key)
|
private.update_historical_value_button()
|
||||||
private.historical_value_button.amount = historical_value
|
|
||||||
private.historical_value_button:SetText(Aux.money.to_string(historical_value or 0, true, nil, 3))
|
|
||||||
|
|
||||||
if not existing_auctions[selected_item.key] then
|
if not existing_auctions[selected_item.key] then
|
||||||
private.refresh_entries()
|
private.refresh_entries()
|
||||||
@@ -935,11 +939,13 @@ function private.refresh_entries()
|
|||||||
end,
|
end,
|
||||||
on_abort = function()
|
on_abort = function()
|
||||||
existing_auctions[item_key] = nil
|
existing_auctions[item_key] = nil
|
||||||
|
private.update_historical_value_button()
|
||||||
private.status_bar:update_status(100, 100)
|
private.status_bar:update_status(100, 100)
|
||||||
private.status_bar:set_text('Done Scanning')
|
private.status_bar:set_text('Done Scanning')
|
||||||
end,
|
end,
|
||||||
on_complete = function()
|
on_complete = function()
|
||||||
existing_auctions[item_key] = existing_auctions[item_key] or {}
|
existing_auctions[item_key] = existing_auctions[item_key] or {}
|
||||||
|
private.update_historical_value_button()
|
||||||
private.update_recommendation()
|
private.update_recommendation()
|
||||||
refresh = true
|
refresh = true
|
||||||
private.status_bar:update_status(100, 100)
|
private.status_bar:update_status(100, 100)
|
||||||
|
|||||||
Reference in New Issue
Block a user