Skip to content

Commit

Permalink
update trade/loop queries to "include" results correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-J-Mason committed Jul 7, 2024
1 parent 5a1679b commit b3e37cb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ WITH stations_in_range AS (SELECT station.id,
FROM public.station
INNER JOIN system ON station.system_id = system.id
WHERE st_3ddwithin(st_makepoint(#{xCoordinate}, #{yCoordinate}, #{zCoordinate}), coordinates_geom, 300)
`<if test='!includeFleetCarriers'>
AND station.fleet_carrier = #{includeFleetCarriers}
</if>
<if test='!includeOdyssey'>
AND station.require_odyssey = #{includeOdyssey}
</if>
<if test='!includeSurfaceStations'>
AND station.planetary = #{includeSurfaceStations}
</if>
<if test='maxLandingPadSize == "LARGE"'>AND max_landing_pad_size = 'LARGE'</if>
<if test='maxLandingPadSize == "MEDIUM"'>AND max_landing_pad_size IN ('MEDIUM', 'LARGE')</if>
AND #{maxArrivalDistance} >= arrival_distance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ WITH stations_in_range AS MATERIALIZED (SELECT station.id,
WHERE st_3ddwithin((select coordinates_geom
from system
where system.name = #{sellToSystemName}), coordinates_geom, #{maxRouteDistance})
<if test='!includeFleetCarriers'>
AND station.fleet_carrier = #{includeFleetCarriers}
</if>
<if test='!includeOdyssey'>
AND station.require_odyssey = #{includeOdyssey}
</if>
<if test='!includeSurfaceStations'>
AND station.planetary = #{includeSurfaceStations}
</if>
<if test='maxLandingPadSize == "LARGE"'>AND max_landing_pad_size = 'LARGE'</if>
<if test='maxLandingPadSize == "MEDIUM"'>AND max_landing_pad_size IN ('MEDIUM', 'LARGE')</if>
AND #{maxArrivalDistance} >= arrival_distance),
Expand Down Expand Up @@ -128,9 +134,15 @@ WITH stations_in_range AS MATERIALIZED (SELECT station.id,
WHERE st_3ddwithin((select coordinates_geom
from system
where system.name = #{sellToSystemName}), coordinates_geom, #{maxRouteDistance})
<if test='!includeFleetCarriers'>
AND station.fleet_carrier = #{includeFleetCarriers}
</if>
<if test='!includeOdyssey'>
AND station.require_odyssey = #{includeOdyssey}
</if>
<if test='!includeSurfaceStations'>
AND station.planetary = #{includeSurfaceStations}
</if>
<if test='maxLandingPadSize == "LARGE"'>AND max_landing_pad_size = 'LARGE'</if>
<if test='maxLandingPadSize == "MEDIUM"'>AND max_landing_pad_size IN ('MEDIUM', 'LARGE')</if>
AND #{maxArrivalDistance} >= arrival_distance),
Expand Down Expand Up @@ -221,9 +233,15 @@ WITH stations_in_range AS MATERIALIZED (SELECT station.id,
WHERE st_3ddwithin((select coordinates_geom
from system
where system.name = #{buyFromSystemName}), coordinates_geom, #{maxRouteDistance})
<if test='!includeFleetCarriers'>
AND station.fleet_carrier = #{includeFleetCarriers}
</if>
<if test='!includeOdyssey'>
AND station.require_odyssey = #{includeOdyssey}
</if>
<if test='!includeSurfaceStations'>
AND station.planetary = #{includeSurfaceStations}
</if>
<if test='maxLandingPadSize == "LARGE"'>AND max_landing_pad_size = 'LARGE'</if>
<if test='maxLandingPadSize == "MEDIUM"'>AND max_landing_pad_size IN ('MEDIUM', 'LARGE')</if>
AND #{maxArrivalDistance} >= arrival_distance),
Expand Down Expand Up @@ -313,9 +331,15 @@ WITH stations_in_range AS MATERIALIZED (SELECT station.id,
WHERE st_3ddwithin((select coordinates_geom
from system
where system.name = #{buyFromSystemName}), coordinates_geom, #{maxRouteDistance})
<if test='!includeFleetCarriers'>
AND station.fleet_carrier = #{includeFleetCarriers}
</if>
<if test='!includeOdyssey'>
AND station.require_odyssey = #{includeOdyssey}
</if>
<if test='!includeSurfaceStations'>
AND station.planetary = #{includeSurfaceStations}
</if>
<if test='maxLandingPadSize == "LARGE"'>AND max_landing_pad_size = 'LARGE'</if>
<if test='maxLandingPadSize == "MEDIUM"'>AND max_landing_pad_size IN ('MEDIUM', 'LARGE')</if>
AND #{maxArrivalDistance} >= arrival_distance),
Expand Down Expand Up @@ -404,9 +428,15 @@ WITH buy_system AS MATERIALIZED (SELECT station.id,
FROM station
INNER JOIN system ON station.system_id = system.id
WHERE system.name = #{buyFromSystemName}
<if test='!includeFleetCarriers'>
AND station.fleet_carrier = #{includeFleetCarriers}
</if>
<if test='!includeOdyssey'>
AND station.require_odyssey = #{includeOdyssey}
</if>
<if test='!includeSurfaceStations'>
AND station.planetary = #{includeSurfaceStations}
</if>
<if test='maxLandingPadSize == "LARGE"'>AND max_landing_pad_size = 'LARGE'</if>
<if test='maxLandingPadSize == "MEDIUM"'>AND max_landing_pad_size IN ('MEDIUM', 'LARGE')</if>
AND #{maxArrivalDistance} >= arrival_distance),
Expand All @@ -417,9 +447,15 @@ sell_system AS (select station.id,
FROM station
INNER JOIN system ON station.system_id = system.id
WHERE system.name = #{sellToSystemName}
<if test='!includeFleetCarriers'>
AND station.fleet_carrier = #{includeFleetCarriers}
</if>
<if test='!includeOdyssey'>
AND station.require_odyssey = #{includeOdyssey}
</if>
<if test='!includeSurfaceStations'>
AND station.planetary = #{includeSurfaceStations}
</if>
<if test='maxLandingPadSize == "LARGE"'>AND max_landing_pad_size = 'LARGE'</if>
<if test='maxLandingPadSize == "MEDIUM"'>AND max_landing_pad_size IN ('MEDIUM', 'LARGE')</if>
AND #{maxArrivalDistance} >= arrival_distance),
Expand Down

0 comments on commit b3e37cb

Please sign in to comment.