Update public.logbook_update_gpx_fn to be display in order

Update public.logbook_update_geojson_fn formating
This commit is contained in:
xbgmsharp
2023-10-09 16:13:56 +02:00
parent ce532bbb4d
commit ef5868d412

View File

@@ -138,7 +138,7 @@ CREATE FUNCTION logbook_update_geojson_fn(IN _id integer, IN _start text, IN _en
SELECT SELECT
json_agg(ST_AsGeoJSON(t.*)::json) into metrics_geojson json_agg(ST_AsGeoJSON(t.*)::json) into metrics_geojson
FROM ( FROM (
( select ( SELECT
time, time,
courseovergroundtrue, courseovergroundtrue,
speedoverground, speedoverground,
@@ -230,9 +230,9 @@ AS $logbook_update_gpx$
AND m.longitude IS NOT NULL AND m.longitude IS NOT NULL
AND m.time >= log_rec._from_time::TIMESTAMP WITHOUT TIME ZONE AND m.time >= log_rec._from_time::TIMESTAMP WITHOUT TIME ZONE
AND m.time <= log_rec._to_time::TIMESTAMP WITHOUT TIME ZONE AND m.time <= log_rec._to_time::TIMESTAMP WITHOUT TIME ZONE
AND vessel_id = log_rec.vessel_id; AND vessel_id = log_rec.vessel_id
-- ERROR: column "m.time" must appear in the GROUP BY clause or be used in an aggregate function at character 2304 GROUP BY m.time
--ORDER BY m.time ASC; ORDER BY m.time ASC;
END; END;
$logbook_update_gpx$ LANGUAGE plpgsql; $logbook_update_gpx$ LANGUAGE plpgsql;
-- Description -- Description
@@ -1239,7 +1239,7 @@ CREATE OR REPLACE FUNCTION public.badges_geom_fn(IN logbook_id integer) RETURNS
user_settings jsonb; user_settings jsonb;
badge_tmp text; badge_tmp text;
begin begin
RAISE NOTICE '--> public.badges_geom_fn user.email [%], vessel.id [%]', current_setting('user.email', false), current_setting('vessel.id', false); --RAISE NOTICE '--> public.badges_geom_fn user.email [%], vessel.id [%]', current_setting('user.email', false), current_setting('vessel.id', false);
-- Tropical & Alaska zone manually add into ne_10m_geography_marine_polys -- Tropical & Alaska zone manually add into ne_10m_geography_marine_polys
-- Check if each geographic marine zone exist as a badge -- Check if each geographic marine zone exist as a badge
FOR marine_rec IN FOR marine_rec IN
@@ -1445,6 +1445,7 @@ BEGIN
delete from api.moorages m where vessel_id = _vessel_id; delete from api.moorages m where vessel_id = _vessel_id;
delete from api.stays s where vessel_id = _vessel_id; delete from api.stays s where vessel_id = _vessel_id;
delete from api.metadata m where vessel_id = _vessel_id; delete from api.metadata m where vessel_id = _vessel_id;
-- TODO remove the badges?
RETURN True; RETURN True;
END END
$delete_account$ language plpgsql security definer; $delete_account$ language plpgsql security definer;