Skip to content

Commit

Permalink
refactor: remove obsolete test files and update SQL logic for feature…
Browse files Browse the repository at this point in the history
… handling
  • Loading branch information
danimarinBG committed Jan 21, 2025
1 parent def2545 commit 6840f3c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 91 deletions.
34 changes: 0 additions & 34 deletions test/plsql/ud/test_gw_fct_pg2epa_inlet_flowtrace.sql

This file was deleted.

34 changes: 0 additions & 34 deletions test/plsql/ws/test_gw_fct_pg2epa_inlet_flowtrace.sql

This file was deleted.

2 changes: 1 addition & 1 deletion ud/fct/ud_gw_fct_pg2epa_main.sql
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ BEGIN

-- move result data
UPDATE rpt_cat_result r set network_stats = t.network_stats FROM temp_t_rpt_cat_result t WHERE r.result_id = t.result_id;

v_return = '{"status": "Accepted", "message":{"level":1, "text":"Export INP file 7/7 - Check according EPA rules...... done succesfully"}}'::json;
RETURN v_return;

END IF;
Expand Down
2 changes: 1 addition & 1 deletion utils/fct/gw_fct_admin_manage_child_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ BEGIN

ELSIF v_action = 'MULTI-CREATE' THEN

v_querytext = 'SELECT cat_feature.* FROM cat_feature WHERE feature_type not in (''LINK'', ''FLWREG'') ORDER BY id';
v_querytext = 'SELECT cat_feature.* FROM cat_feature WHERE feature_type NOT IN (''LINK'', ''FLWREG'') ORDER BY id';

FOR rec IN EXECUTE v_querytext LOOP

Expand Down
41 changes: 20 additions & 21 deletions utils/ftrg/gw_trg_cat_feature.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ BEGIN
DELETE FROM sys_param_user WHERE id = concat('feat_',lower(OLD.id),'_vdefault');
END IF;

IF NEW.feature_class <>'LINK' THEN
IF NEW.feature_class <> 'LINK' AND NEW.feature_type <> 'FLWREG' THEN
INSERT INTO sys_param_user(id, formname, descript, sys_role, label, isenabled, layoutname, layoutorder,
dv_querytext, feature_field_id, project_type, isparent, isautoupdate, datatype, widgettype, ismandatory, iseditable)
VALUES (concat('feat_',v_id,'_vdefault'),'config',concat ('Value default catalog for ',v_id,' cat_feature'), 'role_edit', concat ('Default catalog for ', v_id), true, v_layout ,v_layoutorder,
Expand Down Expand Up @@ -153,7 +153,7 @@ BEGIN
END IF;

--create child view
IF NEW.feature_class <>'LINK' THEN
IF NEW.feature_class <> 'LINK' AND NEW.feature_type <> 'FLWREG' THEN
v_query='{"client":{"device":4, "infoType":1, "lang":"ES"}, "form":{}, "feature":{"catFeature":"'||NEW.id||'"},
"data":{"filterFields":{}, "pageInfo":{}, "action":"SINGLE-CREATE" }}';
PERFORM gw_fct_admin_manage_child_views(v_query::json);
Expand Down Expand Up @@ -207,7 +207,7 @@ BEGIN
PROCEDURE gw_trg_edit_'||lower(NEW.feature_type)||'('||quote_literal(NEW.id)||');';

ELSE
IF NEW.feature_class <>'LINK' THEN
IF NEW.feature_class <> 'LINK' AND NEW.feature_type <> 'FLWREG' THEN
v_query='{"client":{"device":4, "infoType":1, "lang":"ES"}, "form":{}, "feature":{"catFeature":"'||NEW.id||'"},
"data":{"filterFields":{}, "pageInfo":{}, "action":"SINGLE-CREATE" }}';
PERFORM gw_fct_admin_manage_child_views(v_query::json);
Expand Down Expand Up @@ -346,31 +346,30 @@ BEGIN

DELETE FROM config_form_tabs WHERE formname = concat('ve_', lower(old.feature_type), '_', lower(old.id));

IF v_table = 'DELETE' AND OLD.feature_class <>'LINK' THEN
IF v_table = 'DELETE' AND OLD.feature_class <> 'LINK' AND OLD.feature_type <> 'FLWREG' THEN
RETURN OLD;
ELSE
IF OLD.feature_class <>'LINK' THEN
-- delete child views
IF OLD.child_layer IS NOT NULL THEN
EXECUTE 'DROP VIEW IF EXISTS '||OLD.child_layer||';';
END IF;

--delete configuration from config_form_fields
DELETE FROM config_form_fields where formname=OLD.child_layer AND formtype = 'form_feature';
IF OLD.feature_class <> 'LINK' AND OLD.feature_type <> 'FLWREG' THEN
-- delete child views
IF OLD.child_layer IS NOT NULL THEN
EXECUTE 'DROP VIEW IF EXISTS '||OLD.child_layer||';';
END IF;

--delete definition from config_info_layer_x_type
DELETE FROM config_info_layer_x_type where tableinfo_id=OLD.child_layer OR tableinfotype_id=OLD.child_layer;
--delete configuration from config_form_fields
DELETE FROM config_form_fields where formname=OLD.child_layer AND formtype = 'form_feature';

--delete definition from sys_table
DELETE FROM sys_table where id=OLD.child_layer;
--delete definition from config_info_layer_x_type
DELETE FROM config_info_layer_x_type where tableinfo_id=OLD.child_layer OR tableinfotype_id=OLD.child_layer;

-- delete sys_param_user parameters
DELETE FROM sys_param_user WHERE id = concat('feat_',lower(OLD.id),'_vdefault');
--delete definition from sys_table
DELETE FROM sys_table where id=OLD.child_layer;

IF v_projecttype = 'WS' and OLD.feature_class = 'NETWJOIN' THEN
DELETE FROM config_form_tabs where formname=OLD.child_layer and tabname in ('tab_hydrometer', 'tab_hydrometer_val');
END IF;
-- delete sys_param_user parameters
DELETE FROM sys_param_user WHERE id = concat('feat_',lower(OLD.id),'_vdefault');

IF v_projecttype = 'WS' and OLD.feature_class = 'NETWJOIN' THEN
DELETE FROM config_form_tabs where formname=OLD.child_layer and tabname in ('tab_hydrometer', 'tab_hydrometer_val');
END IF;
END IF;
RETURN NULL;
END IF;
Expand Down

0 comments on commit 6840f3c

Please sign in to comment.