fix
This commit is contained in:
parent
d507710fc8
commit
97054be543
8 changed files with 188 additions and 103 deletions
|
|
@ -897,34 +897,27 @@ AND postponement_granted IS NULL;</sql>
|
|||
<create_parent_folder>N</create_parent_folder>
|
||||
<exec_per_row>Y</exec_per_row>
|
||||
<filename>${PROJECT_HOME}/mil_com/main_dashboard.waiting_registration(m_c)/main_dashboard.waiting_registration(m_c).hwf</filename>
|
||||
<logext/>
|
||||
<logfile/>
|
||||
<loglevel>Nothing</loglevel>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<name>ARR_PR_1</name>
|
||||
<stream_name>PART_RECRUITMENT_1</stream_name>
|
||||
<value/>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>ARR_PR_2</name>
|
||||
<stream_name>PART_RECRUITMENT_2</stream_name>
|
||||
<value/>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>ARR_PR_3</name>
|
||||
<stream_name>PART_RECRUITMENT_3</stream_name>
|
||||
<value/>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>ARR_PR_4</name>
|
||||
<stream_name>PART_RECRUITMENT_4</stream_name>
|
||||
<value/>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>ARR_PR_5</name>
|
||||
<stream_name>PART_RECRUITMENT_5</stream_name>
|
||||
<value/>
|
||||
</parameter>
|
||||
<pass_all_parameters>Y</pass_all_parameters>
|
||||
</parameters>
|
||||
|
|
@ -2002,7 +1995,7 @@ WHERE recording_date = current_date
|
|||
<hop>
|
||||
<from>array_recruitments.hpl</from>
|
||||
<to>SQL recruitment_campaign.appeals</to>
|
||||
<enabled>Y</enabled>
|
||||
<enabled>N</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
|
|
|
|||
|
|
@ -513,13 +513,14 @@ summary_all AS (
|
|||
recruitment_id,
|
||||
registered,
|
||||
convicts,
|
||||
'ALL' AS gender,
|
||||
gender,
|
||||
SUM(study) AS study,
|
||||
SUM(work) AS work,
|
||||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
GROUP BY recruitment_id, registered, convicts
|
||||
WHERE gender in ('M', 'W') and convicts in ('CONVICT', 'NOTCONVICT')
|
||||
GROUP BY recruitment_id, registered, convicts, gender
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
|
@ -533,6 +534,7 @@ summary_all AS (
|
|||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
WHERE convicts in ('ALL')
|
||||
GROUP BY recruitment_id, registered
|
||||
)
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -513,13 +513,14 @@ summary_all AS (
|
|||
recruitment_id,
|
||||
registered,
|
||||
convicts,
|
||||
'ALL' AS gender,
|
||||
gender,
|
||||
SUM(study) AS study,
|
||||
SUM(work) AS work,
|
||||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
GROUP BY recruitment_id, registered, convicts
|
||||
WHERE gender in ('M', 'W') and convicts in ('CONVICT', 'NOTCONVICT')
|
||||
GROUP BY recruitment_id, registered, convicts, gender
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
|
@ -533,6 +534,7 @@ summary_all AS (
|
|||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
WHERE convicts in ('ALL')
|
||||
GROUP BY recruitment_id, registered
|
||||
)
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -513,13 +513,14 @@ summary_all AS (
|
|||
recruitment_id,
|
||||
registered,
|
||||
convicts,
|
||||
'ALL' AS gender,
|
||||
gender,
|
||||
SUM(study) AS study,
|
||||
SUM(work) AS work,
|
||||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
GROUP BY recruitment_id, registered, convicts
|
||||
WHERE gender in ('M', 'W') and convicts in ('CONVICT', 'NOTCONVICT')
|
||||
GROUP BY recruitment_id, registered, convicts, gender
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
|
@ -533,6 +534,7 @@ summary_all AS (
|
|||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
WHERE convicts in ('ALL')
|
||||
GROUP BY recruitment_id, registered
|
||||
)
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -513,13 +513,14 @@ summary_all AS (
|
|||
recruitment_id,
|
||||
registered,
|
||||
convicts,
|
||||
'ALL' AS gender,
|
||||
gender,
|
||||
SUM(study) AS study,
|
||||
SUM(work) AS work,
|
||||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
GROUP BY recruitment_id, registered, convicts
|
||||
WHERE gender in ('M', 'W') and convicts in ('CONVICT', 'NOTCONVICT')
|
||||
GROUP BY recruitment_id, registered, convicts, gender
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
|
@ -533,6 +534,7 @@ summary_all AS (
|
|||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
WHERE convicts in ('ALL')
|
||||
GROUP BY recruitment_id, registered
|
||||
)
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -513,13 +513,14 @@ summary_all AS (
|
|||
recruitment_id,
|
||||
registered,
|
||||
convicts,
|
||||
'ALL' AS gender,
|
||||
gender,
|
||||
SUM(study) AS study,
|
||||
SUM(work) AS work,
|
||||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
GROUP BY recruitment_id, registered, convicts
|
||||
WHERE gender in ('M', 'W') and convicts in ('CONVICT', 'NOTCONVICT')
|
||||
GROUP BY recruitment_id, registered, convicts, gender
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
|
@ -533,6 +534,7 @@ summary_all AS (
|
|||
SUM(no_info) AS no_info,
|
||||
SUM(total_people) AS total_people
|
||||
FROM summary
|
||||
WHERE convicts in ('ALL')
|
||||
GROUP BY recruitment_id, registered
|
||||
)
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -692,12 +692,8 @@
|
|||
<loglevel>Basic</loglevel>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<name>VK_ARRAY</name>
|
||||
<stream_name>VK_ARRAY_ID</stream_name>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>REG_ID</name>
|
||||
<stream_name>RECRUITMENT_REG_ID</stream_name>
|
||||
<name>ARR_REG</name>
|
||||
<stream_name>ARRAY_REGION</stream_name>
|
||||
</parameter>
|
||||
<pass_all_parameters>Y</pass_all_parameters>
|
||||
</parameters>
|
||||
|
|
@ -708,7 +704,7 @@
|
|||
<wait_until_finished>Y</wait_until_finished>
|
||||
<parallel>N</parallel>
|
||||
<xloc>1696</xloc>
|
||||
<yloc>1344</yloc>
|
||||
<yloc>16</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
|
|
@ -718,7 +714,7 @@
|
|||
<attributes/>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2224</xloc>
|
||||
<yloc>1344</yloc>
|
||||
<yloc>16</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
|
|
@ -1347,24 +1343,6 @@ WHERE recording_date = current_date
|
|||
<yloc>1264</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
<name>recruitment_campaign.appeals</name>
|
||||
<description/>
|
||||
<type>SQL</type>
|
||||
<attributes/>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<sendOneStatement>N</sendOneStatement>
|
||||
<sql>DELETE FROM recruitment_campaign.appeals
|
||||
WHERE recording_date = current_date
|
||||
AND schema = 'REG_LVL'
|
||||
</sql>
|
||||
<sqlfromfile>N</sqlfromfile>
|
||||
<useVariableSubstitution>N</useVariableSubstitution>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2016</xloc>
|
||||
<yloc>1344</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
<name>appeals.topic_appeal(reg).hpl</name>
|
||||
<description/>
|
||||
|
|
@ -1652,20 +1630,6 @@ WHERE recording_date = current_date
|
|||
<evaluation>Y</evaluation>
|
||||
<unconditional>Y</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>recruitment_campaign.appeals(reg)</from>
|
||||
<to>recruitment_campaign.appeals</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>recruitment_campaign.appeals</from>
|
||||
<to>Success 16</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>Y</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>job_get_rows_reg.hwf</from>
|
||||
<to>main_dashboard.recruitment_campaign(reg)</to>
|
||||
|
|
@ -1757,13 +1721,6 @@ WHERE recording_date = current_date
|
|||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>job_get_rows_reg.hwf</from>
|
||||
<to>recruitment_campaign.appeals(reg)</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>array_region.hpl</from>
|
||||
<to>appeals.topic_appeal(reg).hpl</to>
|
||||
|
|
@ -1778,6 +1735,20 @@ WHERE recording_date = current_date
|
|||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>recruitment_campaign.appeals(reg)</from>
|
||||
<to>Success 16</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>array_region.hpl</from>
|
||||
<to>recruitment_campaign.appeals(reg)</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
</hops>
|
||||
<notepads>
|
||||
</notepads>
|
||||
|
|
|
|||
|
|
@ -24,19 +24,90 @@
|
|||
<hop>
|
||||
<from>Get variables 3 2</from>
|
||||
<to>Select values 3 2</to>
|
||||
<enabled>Y</enabled>
|
||||
<enabled>N</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (appeal_document) регионы</from>
|
||||
<to>Get variables 3 2</to>
|
||||
<enabled>Y</enabled>
|
||||
<enabled>N</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Select values 3 2</from>
|
||||
<to>Insert / update (main_dashboard.appeals)</to>
|
||||
<enabled>N</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Execute SQL script</from>
|
||||
<to>Table input (appeal_document) регионы</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Insert / update (main_dashboard.appeals)</from>
|
||||
<to>Execute SQL script 2</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>Table input (appeal_document) регионы</from>
|
||||
<to>Insert / update (main_dashboard.appeals)</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Execute SQL script</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>N</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>DELETE FROM recruitment_campaign.appeals
|
||||
WHERE recording_date = current_date
|
||||
AND schema = 'Organization'</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>256</xloc>
|
||||
<yloc>272</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Execute SQL script 2</name>
|
||||
<type>ExecSql</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<arguments>
|
||||
</arguments>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<quoteString>N</quoteString>
|
||||
<replace_variables>N</replace_variables>
|
||||
<set_params>N</set_params>
|
||||
<single_statement>N</single_statement>
|
||||
<sql>DELETE FROM recruitment_campaign.appeals
|
||||
WHERE recording_date = current_date
|
||||
AND schema = 'REG_LVL'</sql>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1360</xloc>
|
||||
<yloc>272</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Get variables 3 2</name>
|
||||
<type>GetVariable</type>
|
||||
|
|
@ -66,8 +137,8 @@
|
|||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>720</xloc>
|
||||
<yloc>272</yloc>
|
||||
<xloc>704</xloc>
|
||||
<yloc>416</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
|
|
@ -87,17 +158,26 @@
|
|||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>REG_ID</name>
|
||||
<name>recruitment_id</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>schema</field>
|
||||
<name>schema</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>spring_autumn</field>
|
||||
<name>spring_autumn</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recording_date</field>
|
||||
<name>recording_date</name>
|
||||
<name2/>
|
||||
</key>
|
||||
<schema>recruitment_campaign</schema>
|
||||
<table>appeals</table>
|
||||
|
|
@ -209,15 +289,15 @@
|
|||
</fields>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>864</xloc>
|
||||
<yloc>272</yloc>
|
||||
<xloc>848</xloc>
|
||||
<yloc>416</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input (appeal_document) регионы</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>N</distribute>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
|
|
@ -227,38 +307,69 @@
|
|||
<connection>ervu-dashboard</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>SELECT
|
||||
COALESCE(SUM(total_appeals), 0) total_appeals,
|
||||
COALESCE(SUM(average_consideration), 0) average_consideration,
|
||||
COALESCE(SUM(resolved), 0) resolved,
|
||||
COALESCE(SUM(not_resolved), 0) not_resolved,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_appeals) > 0
|
||||
THEN ROUND((SUM(not_resolved) / SUM(total_appeals) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) not_resolved_percent,
|
||||
<sql>WITH
|
||||
ids AS (
|
||||
SELECT unnest(string_to_array(trim(both '{}' from '${ARR_REG}'), ','))::uuid AS recruitment_id
|
||||
),
|
||||
base_data AS (
|
||||
SELECT
|
||||
region_id,
|
||||
solution_type,
|
||||
CASE
|
||||
WHEN incoming_date <> '-' THEN incoming_date::date
|
||||
ELSE NULL
|
||||
END AS incoming_date,
|
||||
|
||||
COALESCE(SUM(average_rating), 0) average_rating,
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN SUM(total_appeals) > 0
|
||||
THEN ROUND((SUM(resolved) / SUM(total_appeals) * 100), 2)
|
||||
ELSE 0
|
||||
END,
|
||||
0
|
||||
) resolved_percent,
|
||||
CASE
|
||||
WHEN fact_end_date <> '-' THEN fact_end_date::date
|
||||
ELSE NULL
|
||||
END AS fact_end_date,
|
||||
|
||||
'${REG_ID}' AS recruitment_id,
|
||||
spring_autumn,
|
||||
'Organization' AS schema
|
||||
FROM recruitment_campaign.appeals
|
||||
WHERE recruitment_id = ANY ('${VK_ARRAY}')
|
||||
AND schema IN ('Department', 'REG_LVL')
|
||||
AND recording_date = CURRENT_DATE
|
||||
GROUP BY spring_autumn;</sql>
|
||||
CASE
|
||||
WHEN response_evalution <> '-' THEN response_evalution::NUMERIC -- оценка ответа заявителем
|
||||
ELSE 0
|
||||
END AS response_evalution,
|
||||
source
|
||||
FROM appeals.appeals_list al
|
||||
WHERE region_id::uuid IN (SELECT recruitment_id FROM ids)
|
||||
),
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
region_id AS recruitment_id,
|
||||
COUNT(*) AS total_appeals,
|
||||
COUNT(*) FILTER (WHERE solution_type = 'Решено') AS resolved,
|
||||
COUNT(*) FILTER (WHERE solution_type != 'Решено') AS not_resolved,
|
||||
-- Среднее время рассмотрения, учитывая возможные NULL для дат
|
||||
ROUND(AVG(CASE
|
||||
WHEN fact_end_date IS NOT NULL AND incoming_date IS NOT NULL
|
||||
THEN fact_end_date::DATE - incoming_date::DATE
|
||||
ELSE NULL
|
||||
END), 1) AS average_consideration,
|
||||
-- Средний рейтинг, учитывая 0 для некорректных значений
|
||||
ROUND(AVG(COALESCE(response_evalution, 0)), 1) AS average_rating
|
||||
--COUNT(*) FILTER (WHERE source = 'ПОС') AS total_pos,
|
||||
--COUNT(*) FILTER (WHERE source = 'ЕПГУ') AS total_epgu
|
||||
FROM base_data
|
||||
GROUP BY region_id
|
||||
)
|
||||
SELECT
|
||||
i.recruitment_id,
|
||||
current_date AS recording_date,
|
||||
'Весна' AS spring_autumn,
|
||||
'Organization' AS schema,
|
||||
COALESCE(ad.total_appeals, 0) AS total_appeals,
|
||||
COALESCE(ad.resolved, 0) AS resolved,
|
||||
COALESCE(ad.not_resolved, 0) AS not_resolved,
|
||||
COALESCE(ad.average_consideration, 0) AS average_consideration,
|
||||
COALESCE(ad.average_rating, 0) AS average_rating,
|
||||
COALESCE(ROUND(ad.resolved::NUMERIC * 100 / NULLIF(ad.total_appeals, 0), 1), 0) AS resolved_percent,
|
||||
COALESCE(ROUND(ad.not_resolved::NUMERIC * 100 / NULLIF(ad.total_appeals, 0), 1), 0) AS not_resolved_percent
|
||||
--COALESCE(ad.total_pos, 0) AS average_to_face,
|
||||
--COALESCE(ad.total_epgu, 0) AS average_epgu,
|
||||
--COALESCE(ROUND(ad.total_pos::NUMERIC * 100 / NULLIF(ad.total_appeals, 0), 1), 0) AS average_to_face_percent,
|
||||
--COALESCE(ROUND(ad.total_epgu::NUMERIC * 100 / NULLIF(ad.total_appeals, 0), 1), 0) AS average_epgu_percent
|
||||
FROM ids i
|
||||
LEFT JOIN aggregated_data ad ON ad.recruitment_id = i.recruitment_id;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue