diff --git a/sql/pg_orrery--0.16.0--0.17.0.sql b/sql/pg_orrery--0.16.0--0.17.0.sql index d63abd0..e671bfa 100644 --- a/sql/pg_orrery--0.16.0--0.17.0.sql +++ b/sql/pg_orrery--0.16.0--0.17.0.sql @@ -85,8 +85,8 @@ BEGIN illum := moon_illumination(astro_dusk); IF illum > 0.75 THEN -- Check if Moon is above horizon during darkness - moon_up := (moon_observe($1, astro_dusk)).elevation > 0 - OR (moon_observe($1, astro_dusk + (astro_dawn - astro_dusk) / 2)).elevation > 0; + moon_up := topo_elevation(moon_observe($1, astro_dusk)) > 0 + OR topo_elevation(moon_observe($1, astro_dusk + (astro_dawn - astro_dusk) / 2)) > 0; IF moon_up THEN score := score - (illum * 30)::int; -- Up to -30 for full moon END IF; diff --git a/sql/pg_orrery--0.17.0.sql b/sql/pg_orrery--0.17.0.sql index 6585b5e..924a42c 100644 --- a/sql/pg_orrery--0.17.0.sql +++ b/sql/pg_orrery--0.17.0.sql @@ -1759,8 +1759,8 @@ BEGIN illum := moon_illumination(astro_dusk); IF illum > 0.75 THEN -- Check if Moon is above horizon during darkness - moon_up := (moon_observe($1, astro_dusk)).elevation > 0 - OR (moon_observe($1, astro_dusk + (astro_dawn - astro_dusk) / 2)).elevation > 0; + moon_up := topo_elevation(moon_observe($1, astro_dusk)) > 0 + OR topo_elevation(moon_observe($1, astro_dusk + (astro_dawn - astro_dusk) / 2)) > 0; IF moon_up THEN score := score - (illum * 30)::int; -- Up to -30 for full moon END IF;