Skip to content

Commit

Permalink
fix(trg sector): Add sector_type strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
xtorret committed Jan 2, 2025
1 parent 0fc5149 commit 4818dee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ws/ftrg/ws_gw_trg_edit_sector.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 4818dee

Please sign in to comment.