From 4818dee805270adc942e9beb241d912c4be07b00 Mon Sep 17 00:00:00 2001 From: Xavier Torret Date: Thu, 2 Jan 2025 19:07:28 +0100 Subject: [PATCH] fix(trg sector): Add sector_type strategy --- ws/ftrg/ws_gw_trg_edit_sector.sql | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ws/ftrg/ws_gw_trg_edit_sector.sql b/ws/ftrg/ws_gw_trg_edit_sector.sql index c24a78114..62da3f60b 100644 --- a/ws/ftrg/ws_gw_trg_edit_sector.sql +++ b/ws/ftrg/ws_gw_trg_edit_sector.sql @@ -18,8 +18,8 @@ BEGIN IF TG_OP = 'INSERT' THEN - INSERT INTO sector (sector_id, name, descript, macrosector_id, the_geom, undelete, graphconfig, stylesheet, active, parent_id, pattern_id, avg_press) - VALUES (NEW.sector_id, NEW.name, NEW.descript, NEW.macrosector_id, NEW.the_geom, NEW.undelete, + INSERT INTO sector (sector_id, name, descript, macrosector_id, sector_type, the_geom, undelete, graphconfig, stylesheet, active, parent_id, pattern_id, avg_press) + VALUES (NEW.sector_id, NEW.name, NEW.descript, NEW.macrosector_id, NEW.sector_type, NEW.the_geom, NEW.undelete, NEW.graphconfig::json, NEW.stylesheet::json, true, NEW.parent_id, NEW.pattern_id, NEW.avg_press); INSERT INTO selector_sector VALUES (NEW.sector_id, current_user); @@ -28,6 +28,12 @@ BEGIN ELSIF TG_OP = 'UPDATE' THEN + UPDATE sector + SET sector_id=NEW.sector_id, name=NEW.name, descript=NEW.descript, sector_type = NEW.sector_type, macrosector_id=NEW.macrosector_id, the_geom=NEW.the_geom, + undelete=NEW.undelete, graphconfig=NEW.graphconfig::json, stylesheet = NEW.stylesheet::json, active = NEW.active, parent_id = NEW.parent_id, pattern_id = NEW.pattern_id, + lastupdate=now(), lastupdate_user = current_user, avg_press = NEW.avg_press + WHERE sector_id=OLD.sector_id; + RETURN NEW; ELSIF TG_OP = 'DELETE' THEN