Skip to content

Commit

Permalink
feat(selector sector): Sector-0 always selected hidding on selector a…
Browse files Browse the repository at this point in the history
…nd forcing it for code
  • Loading branch information
xtorret committed Aug 19, 2024
1 parent 5a31af8 commit 6300ae9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion updates/36/36012/utils/dml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,6 @@ UPDATE config_param_system set value = gw_fct_json_object_set_key(value::json, '
UPDATE config_param_system set value = gw_fct_json_object_set_key(value::json, 'selectionMode', 'keepPreviousUsingShift'::text) where parameter = 'basic_selector_tab_macrosector';
UPDATE config_param_system set value = gw_fct_json_object_set_key(value::json, 'selectionMode', 'keepPreviousUsingShift'::text) where parameter = 'basic_selector_tab_macroexploitation';

UPDATE link SET muni_id = c.muni_id FROM connec c WHERE connec_id = feature_id;
UPDATE config_param_system set value = repalce(value, 'sector_id >=0', 'sector_id >0') where parameter = 'basic_selector_tab_sector';

UPDATE link SET muni_id = c.muni_id FROM connec c WHERE connec_id = feature_id;
3 changes: 3 additions & 0 deletions utils/fct/gw_fct_setinitproject.sql
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ BEGIN
INSERT INTO audit_check_data (fid, criticity, error_message) VALUES (101, 4, v_errortext);
END IF;

-- Force sector selector for 0 values
INSERT selector_sector VALUES (0, current_user) ON CONFLICT (sector_id, cur_user) DO NOTHING;

-- force hydrometer_selector in case of null values
IF (select cur_user FROM selector_hydrometer WHERE cur_user = current_user limit 1) IS NULL THEN
INSERT INTO selector_hydrometer (state_id, cur_user)
Expand Down
10 changes: 6 additions & 4 deletions utils/fct/gw_fct_setselectors.sql
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,10 @@ BEGIN
IF v_tabname IN ('tab_exploitation', 'tab_macroexploitation') THEN

-- sector
DELETE FROM selector_sector WHERE cur_user = current_user;
DELETE FROM selector_sector WHERE cur_user = current_user AND sector_id > 0;
INSERT INTO selector_sector
SELECT DISTINCT sector_id, current_user FROM node WHERE expl_id IN (SELECT expl_id FROM selector_expl WHERE cur_user = current_user);
SELECT DISTINCT sector_id, current_user FROM node WHERE expl_id IN (SELECT expl_id FROM selector_expl WHERE cur_user = current_user)
ON CONFLICT (sector_id, cur_user) DO NOTHING;

-- muni
DELETE FROM selector_municipality WHERE cur_user = current_user;
Expand Down Expand Up @@ -406,9 +407,10 @@ BEGIN
SELECT DISTINCT expl_id, current_user FROM node WHERE muni_id IN (SELECT muni_id FROM selector_municipality WHERE cur_user = current_user);

-- sector
DELETE FROM selector_sector WHERE cur_user = current_user;
DELETE FROM selector_sector WHERE cur_user = current_user AND sector_id > 0;
INSERT INTO selector_sector
SELECT DISTINCT sector_id, current_user FROM node WHERE muni_id IN (SELECT muni_id FROM selector_municipality WHERE cur_user = current_user);
SELECT DISTINCT sector_id, current_user FROM node WHERE muni_id IN (SELECT muni_id FROM selector_municipality WHERE cur_user = current_user)
ON CONFLICT (sector_id, cur_user) DO NOTHING;
END IF;

END IF;
Expand Down

0 comments on commit 6300ae9

Please sign in to comment.