Skip to content

Commit

Permalink
hotpatch commodity market few.
Browse files Browse the repository at this point in the history
correct stations_with_buy_price to discount 0's
adjust lowest_buying_from and highest_selling_to to join on commodity id to list correct stations rather than global
  • Loading branch information
Daniel-J-Mason committed Jul 18, 2024
1 parent 2856937 commit a69024f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
COUNT(NULLIF(buy_price, 0)) AS stations_with_buy_price,
COUNT(NULLIF(sell_price, 0)) AS stations_with_sell_price,
SUM((buy_price < mean_price)::int) AS stations_with_buy_price_lower_than_average,
SUM((NULLIF(buy_price, 0) < mean_price)::int) AS stations_with_buy_price_lower_than_average,
SUM((sell_price > mean_price)::int) AS stations_with_sell_price_higher_than_average
FROM latest_market_datum
Expand All @@ -39,11 +39,11 @@
select commodity_stats.*,
(select station_id
FROM latest_market_datum
where sell_price = commodity_stats.max_sell_price
where commodity_id = commodity_stats.commodity_id and sell_price = commodity_stats.max_sell_price
LIMIT 1) as highest_selling_to_station,
(select station_id
FROM latest_market_datum
where buy_price = commodity_stats.min_buy_price
where commodity_id = commodity_stats.commodity_id and buy_price = commodity_stats.min_buy_price
LIMIT 1) as lowest_buying_from_station
from commodity_stats;
]]>
Expand Down

0 comments on commit a69024f

Please sign in to comment.