Skip to content

Commit

Permalink
fix(selector): Minor bug fix from prev commit
Browse files Browse the repository at this point in the history
  • Loading branch information
xtorret committed Dec 31, 2024
1 parent f972d79 commit 7fbdcf2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions updates/36/36017/ud/ddlview.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ SELECT distinct on (sector_id) s.sector_id,
JOIN config_user_x_expl USING (expl_id)
LEFT JOIN macrosector m USING (macrosector_id)
LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text
where username = current_user and sector_id > 0
where username = current_user and (sector_id > 0 or sector <-9)
union
SELECT distinct on (sector_id) s.sector_id,
s.name,
Expand All @@ -1037,7 +1037,7 @@ SELECT distinct on (sector_id) s.sector_id,
LEFT JOIN ( SELECT DISTINCT node.sector_id, node.expl_id FROM node WHERE node.state > 0) a USING (sector_id)
LEFT JOIN macrosector m USING (macrosector_id)
LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text
where s.sector_id > 0 and a.sector_id is null
where (s.sector_id > 0 or s.sector <-9) and a.sector_id is null
ORDER BY 1;


Expand Down
14 changes: 7 additions & 7 deletions updates/36/36017/utils/ddlview.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ SET search_path = SCHEMA_NAME, public, pg_catalog;
CREATE OR REPLACE VIEW vu_exploitation as
select e.* from exploitation e
JOIN config_user_x_expl USING (expl_id)
where username = current_user and expl_id > 0
where username = current_user and (expl_id > 0 or expl_id < -9)
order by 1;

CREATE OR REPLACE VIEW vu_macroexploitation as
select distinct on (macroexpl_id) m.* from macroexploitation m
join exploitation using (macroexpl_id)
JOIN config_user_x_expl USING (expl_id)
where username = current_user and macroexpl_id > 0
where username = current_user and (macroexpl_id > 0 or macroexpl_id < -9)
UNION
select distinct on (macroexpl_id) m.* from macroexploitation m
LEFT join exploitation using (macroexpl_id)
where expl_id IS NULL and macroexpl_id > 0
where expl_id IS NULL and (macroexpl_id > 0 or macroexpl_id < -9)
order by 1;

CREATE OR REPLACE VIEW vu_macrosector as
Expand All @@ -33,22 +33,22 @@ join sector using (macrosector_id)
JOIN (SELECT DISTINCT sector_id, expl_id FROM node WHERE state > 0) a USING (sector_id)
join exploitation using (expl_id)
JOIN config_user_x_expl USING (expl_id)
where username = current_user and macrosector_id > 0
where username = current_user and (macrosector_id > 0 or macrosector_id < -9)
UNION
select distinct on (macrosector_id) m.* from macrosector m
LEFT join sector using (macrosector_id)
where sector_id IS NULL and macrosector_id > 0
where sector_id IS NULL and (macrosector_id > 0 or macrosector_id < -9)
order by 1;

CREATE OR REPLACE VIEW vu_ext_municipality as
select m.* from ext_municipality m
join (SELECT DISTINCT muni_id, expl_id FROM node WHERE state > 0) a USING (muni_id)
JOIN config_user_x_expl USING (expl_id)
where username = current_user and muni_id > 0
where username = current_user and (muni_id > 0 or muni_id < -9)
UNION
select m.* from ext_municipality m
LEFT join (SELECT DISTINCT muni_id, expl_id FROM node WHERE state > 0) a USING (muni_id)
where a.muni_id IS NULL and muni_id > 0
where a.muni_id IS NULL and (muni_id > 0 or muni_id < -9)
order by 1;

CREATE OR REPLACE VIEW v_edit_exploitation
Expand Down
4 changes: 2 additions & 2 deletions updates/36/36017/ws/ddlview.sql
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ SELECT DISTINCT ON (s.sector_id) s.sector_id,
JOIN config_user_x_expl USING (expl_id)
LEFT JOIN macrosector m USING (macrosector_id)
LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text
WHERE config_user_x_expl.username::text = CURRENT_USER AND s.sector_id > 0
WHERE config_user_x_expl.username::text = CURRENT_USER AND (s.sector_id > 0 or s.sector_id < -9)
UNION
select s.sector_id,
s.name,
Expand All @@ -916,7 +916,7 @@ SELECT DISTINCT ON (s.sector_id) s.sector_id,
LEFT JOIN ( SELECT DISTINCT node.sector_id, node.expl_id FROM node WHERE node.state > 0) a USING (sector_id)
LEFT JOIN macrosector m USING (macrosector_id)
LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text
where s.sector_id > 0 and a.sector_id is null
where (s.sector_id > 0 or s.sector_id < -9) and a.sector_id is null
ORDER BY 1;


Expand Down

0 comments on commit 7fbdcf2

Please sign in to comment.