Skip to content

Commit

Permalink
hotpatch removing cases of cargocapity from single hop queries to use…
Browse files Browse the repository at this point in the history
… supply and demand inline with changes from #51
  • Loading branch information
Daniel-J-Mason committed May 15, 2024
1 parent 83074ec commit ca5cad4
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ buy_market AS (SELECT commodity_id,
INNER JOIN stations_in_range ON station_id = stations_in_range.id
INNER JOIN system ON stations_in_range.system_id = system.id
INNER JOIN commodity_list ON commodity_id = commodity_list.id AND display_name IS NOT null
WHERE stock > #{cargoCapacity}
WHERE stock > #{minSupply}
AND commodity_list.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours})
AND buy_price IS NOT null),
Expand All @@ -79,7 +79,7 @@ sell_market AS (SELECT commodity_id,
INNER JOIN stations_in_system ON station_id = stations_in_system.id
INNER JOIN system on stations_in_system.system_id = system.id
INNER JOIN commodity ON commodity_id = commodity.id AND display_name IS NOT null
WHERE (demand = 0 OR demand > (#{cargoCapacity} * 4))
WHERE (demand = 0 OR demand > #{minDemand})
AND commodity.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours}))
Expand Down Expand Up @@ -167,7 +167,7 @@ buy_market AS (SELECT commodity_id,
INNER JOIN stations_in_range ON station_id = stations_in_range.id
INNER JOIN system ON stations_in_range.system_id = system.id
INNER JOIN commodity_list ON commodity_id = commodity_list.id AND display_name IS NOT null
WHERE stock > #{cargoCapacity}
WHERE stock > #{minSupply}
AND commodity_list.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours})
AND buy_price IS NOT null),
Expand All @@ -183,7 +183,7 @@ sell_market AS (SELECT commodity_id,
INNER JOIN reference_station ON station_id = reference_station.id
INNER JOIN system on reference_station.system_id = system.id
INNER JOIN commodity ON commodity_id = commodity.id AND display_name IS NOT null
WHERE (demand = 0 OR demand > (#{cargoCapacity} * 4))
WHERE (demand = 0 OR demand > #{minDemand})
AND commodity.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours}))
Expand Down Expand Up @@ -255,7 +255,7 @@ buy_market AS (SELECT commodity_id,
INNER JOIN reference_station ON station_id = reference_station.id
INNER JOIN system ON reference_station.system_id = system.id
INNER JOIN commodity_list ON commodity_id = commodity_list.id AND display_name IS NOT null
WHERE stock > #{cargoCapacity}
WHERE stock > #{minSupply}
AND commodity_list.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours})
AND buy_price IS NOT null),
Expand All @@ -273,7 +273,7 @@ sell_market AS (SELECT commodity_id,
INNER JOIN stations_in_range ON station_id = stations_in_range.id
INNER JOIN system on stations_in_range.system_id = system.id
INNER JOIN commodity ON commodity_id = commodity.id AND display_name IS NOT null
WHERE (demand = 0 OR demand > (#{cargoCapacity} * 4))
WHERE (demand = 0 OR demand > #{minDemand})
AND commodity.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours}))
Expand Down Expand Up @@ -346,7 +346,7 @@ buy_market AS (SELECT commodity_id,
INNER JOIN reference_station ON station_id = reference_station.id
INNER JOIN system ON reference_station.system_id = system.id
INNER JOIN commodity_list ON commodity_id = commodity_list.id AND display_name IS NOT null
WHERE stock > #{cargoCapacity}
WHERE stock > #{minSupply}
AND commodity_list.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours})
AND buy_price IS NOT null),
Expand All @@ -364,7 +364,7 @@ sell_market AS (SELECT commodity_id,
INNER JOIN stations_in_range ON station_id = stations_in_range.id
INNER JOIN system on stations_in_range.system_id = system.id
INNER JOIN commodity ON commodity_id = commodity.id AND display_name IS NOT null
WHERE (demand = 0 OR demand > (#{cargoCapacity} * 4))
WHERE (demand = 0 OR demand > #{minDemand})
AND commodity.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours}))
Expand Down Expand Up @@ -441,7 +441,7 @@ buy_market AS (SELECT commodity_id,
INNER JOIN buy_system ON station_id = buy_system.id
INNER JOIN system ON buy_system.system_id = system.id
INNER JOIN commodity_list ON commodity_id = commodity_list.id AND display_name IS NOT null
WHERE stock > #{cargoCapacity}
WHERE stock > #{minSupply}
AND commodity_list.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours})
AND buy_price IS NOT null),
Expand All @@ -457,7 +457,7 @@ sell_market AS (SELECT commodity_id,
INNER JOIN sell_system ON station_id = sell_system.id
INNER JOIN system on sell_system.system_id = system.id
INNER JOIN commodity ON commodity_id = commodity.id AND display_name IS NOT null
WHERE (demand = 0 OR demand > (#{cargoCapacity} * 4))
WHERE (demand = 0 OR demand > #{minDemand})
AND commodity.is_rare = false
AND timestamp >= (now() - INTERVAL '1 hour' * #{maxPriceAgeHours}))
Expand Down

0 comments on commit ca5cad4

Please sign in to comment.