Skip to content

Commit 8c26093

Browse files
committed
fix(setpsectorcostremovedpipes): enhance descript and bug fix
1 parent 5bbd369 commit 8c26093

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

updates/36/36012/ws/dml.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ This version of Giswater is provided by Giswater Association
88
SET search_path = SCHEMA_NAME, public, pg_catalog;
99

1010
INSERT INTO sys_function VALUES (3322, 'gw_fct_setpsectorcostremovedpipes', 'ws', 'function', 'json', 'json',
11-
'Function to set cost for removed material on specific psectors', 'role_master', null, 'core')
11+
'Function to set cost for removed material on specific psectors.
12+
Choose the material that has to be removed and the price that costs to remove 1 lineal meter of that material (this price has to exist in column ''id''
13+
of table plan_price. The result is the sum of meters of the chosen material to be removed and the total cost of it for the selected exploitation grouped by psector.
14+
The result will be shown in tab Other of psectors.', 'role_master', null, 'core')
1215
ON CONFLICT (id) DO NOTHING;
1316

1417
INSERT INTO sys_fprocess VALUES (523, 'fprocess to set cost for removed material on psectors','ws',null,'core',FALSE, 'Function process')

ws/fct/ws_gw_fct_setpsectorcostremovedpipes.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ BEGIN
5555

5656

5757
v_sql = 'INSERT INTO plan_psector_x_other (price_id, measurement, psector_id, observ)
58-
SELECT '||quote_literal(v_price)||', sum(gis_length), psector_id, '||quote_literal(v_observ)||' from plan_psector_x_arc JOIN vu_arc USING (arc_id)
59-
WHERE cat_matcat_id = '||quote_literal(v_material)||' and expl_id = '||v_expl||' group by 3';
58+
SELECT '||quote_literal(v_price)||', sum(gis_length), psector_id, '||quote_literal(v_observ)||'
59+
from plan_psector_x_arc ppxa
60+
JOIN vu_arc USING (arc_id)
61+
WHERE cat_matcat_id = '||quote_literal(v_material)||' and
62+
expl_id = '||v_expl||' and ppxa.state=0 group by 3';
6063

6164
EXECUTE v_sql;
6265

@@ -92,7 +95,7 @@ BEGIN
9295
v_result_line := COALESCE(v_result_line, '{}');
9396

9497
-- Return
95-
RETURN (('{"status":"Accepted", "message":{"level":1, "text":"Analysis done successfully"}, "version":"'||v_version||'"'||
98+
RETURN gw_fct_json_create_return(('{"status":"Accepted", "message":{"level":1, "text":"Analysis done successfully"}, "version":"'||v_version||'"'||
9699
',"body":{"form":{}'||
97100
',"data":{ "info":'||v_result_info||','||
98101
'"line":'||v_result_line||

0 commit comments

Comments
 (0)