From 35940917e0d9a9bf6b4e5abd1800466e059ca6a0 Mon Sep 17 00:00:00 2001 From: xbgmsharp Date: Thu, 14 Sep 2023 09:52:19 +0200 Subject: [PATCH] Update api.moorages_view and api.moorage_view, add stay code and stay description in web view --- initdb/02_1_3_signalk_api_views.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/initdb/02_1_3_signalk_api_views.sql b/initdb/02_1_3_signalk_api_views.sql index 5f230f0..e6c2228 100644 --- a/initdb/02_1_3_signalk_api_views.sql +++ b/initdb/02_1_3_signalk_api_views.sql @@ -192,7 +192,7 @@ CREATE OR REPLACE VIEW api.moorages_view WITH (security_invoker=true,security_ba -- m.stay_duration, -- justify_hours ( m.stay_duration ) FROM api.moorages m, api.stays_at sa - WHERE m.name is not null + WHERE m.name IS NOT NULL AND geog IS NOT NULL AND m.stay_code = sa.stay_code GROUP BY m.id,m.name,sa.description,m.stay_duration,m.reference_count,m.geog,sa.stay_code @@ -207,7 +207,7 @@ DROP VIEW IF EXISTS api.moorage_view; CREATE OR REPLACE VIEW api.moorage_view WITH (security_invoker=true,security_barrier=true) AS -- TODO SELECT id, m.name AS Name, - m.stay_code AS Default_Stay, + sa.description AS Default_Stay, sa.stay_code AS Default_Stay_Id, m.home_flag AS Home, EXTRACT(DAY FROM justify_hours ( m.stay_duration )) AS Total_Stay, @@ -215,7 +215,7 @@ CREATE OR REPLACE VIEW api.moorage_view WITH (security_invoker=true,security_bar m.notes -- m.geog FROM api.moorages m, api.stays_at sa - WHERE m.name is not null + WHERE m.name IS NOT NULL AND geog IS NOT NULL AND m.stay_code = sa.stay_code; -- Description