fix +postponement_have_right
This commit is contained in:
parent
98bc567555
commit
3440ba39fe
3 changed files with 468 additions and 3 deletions
|
|
@ -344,7 +344,7 @@
|
|||
<type>SUCCESS</type>
|
||||
<attributes/>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2240</xloc>
|
||||
<xloc>2688</xloc>
|
||||
<yloc>368</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
|
|
@ -371,7 +371,7 @@ WHERE recording_date = current_date
|
|||
<type>SUCCESS</type>
|
||||
<attributes/>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2256</xloc>
|
||||
<xloc>2688</xloc>
|
||||
<yloc>112</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
|
|
@ -531,6 +531,122 @@ WHERE recording_date = current_date
|
|||
<yloc>16</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
<name>array_season_recruitments.hpl 4 2</name>
|
||||
<description/>
|
||||
<type>PIPELINE</type>
|
||||
<attributes/>
|
||||
<add_date>N</add_date>
|
||||
<add_time>N</add_time>
|
||||
<clear_files>N</clear_files>
|
||||
<clear_rows>N</clear_rows>
|
||||
<create_parent_folder>N</create_parent_folder>
|
||||
<exec_per_row>N</exec_per_row>
|
||||
<filename>${PROJECT_HOME}/mil_com/parameters/season_separation/array_season_recruitments.hpl</filename>
|
||||
<loglevel>Basic</loglevel>
|
||||
<parameters>
|
||||
<pass_all_parameters>Y</pass_all_parameters>
|
||||
</parameters>
|
||||
<params_from_previous>N</params_from_previous>
|
||||
<run_configuration>local</run_configuration>
|
||||
<set_append_logfile>N</set_append_logfile>
|
||||
<set_logfile>N</set_logfile>
|
||||
<wait_until_finished>Y</wait_until_finished>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2160</xloc>
|
||||
<yloc>16</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
<name>array_season_recruitments_all.hpl 2 2 2 2</name>
|
||||
<description/>
|
||||
<type>PIPELINE</type>
|
||||
<attributes/>
|
||||
<add_date>N</add_date>
|
||||
<add_time>N</add_time>
|
||||
<clear_files>N</clear_files>
|
||||
<clear_rows>N</clear_rows>
|
||||
<create_parent_folder>N</create_parent_folder>
|
||||
<exec_per_row>N</exec_per_row>
|
||||
<filename>${PROJECT_HOME}/mil_com/parameters/season_separation/array_season_recruitments_all.hpl</filename>
|
||||
<loglevel>Basic</loglevel>
|
||||
<parameters>
|
||||
<pass_all_parameters>Y</pass_all_parameters>
|
||||
</parameters>
|
||||
<params_from_previous>N</params_from_previous>
|
||||
<run_configuration>local</run_configuration>
|
||||
<set_append_logfile>N</set_append_logfile>
|
||||
<set_logfile>N</set_logfile>
|
||||
<wait_until_finished>Y</wait_until_finished>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2160</xloc>
|
||||
<yloc>272</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
<name>m_d.rec_cam(m_c)_to_person_registry_postponement_uniq.hpl</name>
|
||||
<description/>
|
||||
<type>PIPELINE</type>
|
||||
<attributes/>
|
||||
<add_date>N</add_date>
|
||||
<add_time>N</add_time>
|
||||
<clear_files>N</clear_files>
|
||||
<clear_rows>N</clear_rows>
|
||||
<create_parent_folder>N</create_parent_folder>
|
||||
<exec_per_row>Y</exec_per_row>
|
||||
<filename>${PROJECT_HOME}/mil_com/main_dashboard.recruitment_campaign(m_c)/m_d.rec_cam(m_c)_to_person_registry_postponement_uniq.hpl</filename>
|
||||
<loglevel>Basic</loglevel>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<name>ARR_MC_SP</name>
|
||||
<stream_name>ARRAY_MIL_COM_SP</stream_name>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>ARR_MC_AU</name>
|
||||
<stream_name>ARRAY_MIL_COM_AU</stream_name>
|
||||
</parameter>
|
||||
<pass_all_parameters>Y</pass_all_parameters>
|
||||
</parameters>
|
||||
<params_from_previous>Y</params_from_previous>
|
||||
<run_configuration>local</run_configuration>
|
||||
<set_append_logfile>N</set_append_logfile>
|
||||
<set_logfile>N</set_logfile>
|
||||
<wait_until_finished>Y</wait_until_finished>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2560</xloc>
|
||||
<yloc>16</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
<action>
|
||||
<name>m_d.rec_cam(m_c)_to_person_registry_postponement.hpl</name>
|
||||
<description/>
|
||||
<type>PIPELINE</type>
|
||||
<attributes/>
|
||||
<add_date>N</add_date>
|
||||
<add_time>N</add_time>
|
||||
<clear_files>N</clear_files>
|
||||
<clear_rows>N</clear_rows>
|
||||
<create_parent_folder>N</create_parent_folder>
|
||||
<exec_per_row>Y</exec_per_row>
|
||||
<filename>${PROJECT_HOME}/mil_com/main_dashboard.recruitment_campaign(m_c)/m_d.rec_cam(m_c)_to_person_registry_postponement.hpl</filename>
|
||||
<loglevel>Basic</loglevel>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<name>ARR_MC</name>
|
||||
<stream_name>ARRAY_MIL_COM</stream_name>
|
||||
</parameter>
|
||||
<pass_all_parameters>Y</pass_all_parameters>
|
||||
</parameters>
|
||||
<params_from_previous>Y</params_from_previous>
|
||||
<run_configuration>local</run_configuration>
|
||||
<set_append_logfile>N</set_append_logfile>
|
||||
<set_logfile>N</set_logfile>
|
||||
<wait_until_finished>Y</wait_until_finished>
|
||||
<parallel>N</parallel>
|
||||
<xloc>2560</xloc>
|
||||
<yloc>272</yloc>
|
||||
<attributes_hac/>
|
||||
</action>
|
||||
</actions>
|
||||
<hops>
|
||||
<hop>
|
||||
|
|
@ -585,7 +701,7 @@ WHERE recording_date = current_date
|
|||
<hop>
|
||||
<from>m_d.rec_cam(m_c)_to_decision_service.hpl</from>
|
||||
<to>Success all</to>
|
||||
<enabled>Y</enabled>
|
||||
<enabled>N</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
|
|
@ -722,6 +838,48 @@ WHERE recording_date = current_date
|
|||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>m_d.rec_cam(m_c)_to_decision_service.hpl</from>
|
||||
<to>array_season_recruitments_all.hpl 2 2 2 2</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>m_d.rec_cam(m_c)_to_decision_service_uniq.hpl</from>
|
||||
<to>array_season_recruitments.hpl 4 2</to>
|
||||
<enabled>N</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>array_season_recruitments.hpl 4 2</from>
|
||||
<to>m_d.rec_cam(m_c)_to_person_registry_postponement_uniq.hpl</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>m_d.rec_cam(m_c)_to_person_registry_postponement_uniq.hpl</from>
|
||||
<to>Success uniq</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>array_season_recruitments_all.hpl 2 2 2 2</from>
|
||||
<to>m_d.rec_cam(m_c)_to_person_registry_postponement.hpl</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
<hop>
|
||||
<from>m_d.rec_cam(m_c)_to_person_registry_postponement.hpl</from>
|
||||
<to>Success all</to>
|
||||
<enabled>Y</enabled>
|
||||
<evaluation>Y</evaluation>
|
||||
<unconditional>N</unconditional>
|
||||
</hop>
|
||||
</hops>
|
||||
<notepads>
|
||||
<notepad>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,137 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<pipeline>
|
||||
<info>
|
||||
<name>m_d.rec_cam(m_c)_to_person_registry_postponement</name>
|
||||
<name_sync_with_filename>Y</name_sync_with_filename>
|
||||
<description/>
|
||||
<extended_description/>
|
||||
<pipeline_version/>
|
||||
<pipeline_type>Normal</pipeline_type>
|
||||
<pipeline_status>0</pipeline_status>
|
||||
<parameters>
|
||||
</parameters>
|
||||
<capture_transform_performance>N</capture_transform_performance>
|
||||
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
|
||||
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
|
||||
<created_user>-</created_user>
|
||||
<created_date>2024/08/02 11:56:22.507</created_date>
|
||||
<modified_user>-</modified_user>
|
||||
<modified_date>2024/08/02 11:56:22.507</modified_date>
|
||||
</info>
|
||||
<notepads>
|
||||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Table input (person_registry) регион/осень</from>
|
||||
<to>Update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Table input (person_registry) регион/осень</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>postgres.person_registry</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>WITH
|
||||
ids AS (
|
||||
SELECT unnest(string_to_array(trim(both '{}' from '${ARR_MC}'), ','))::uuid AS recruitment_id
|
||||
),
|
||||
vse AS(
|
||||
SELECT
|
||||
CASE
|
||||
WHEN dd.hidden is true THEN 'true'
|
||||
ELSE 'false'
|
||||
END AS postponement,
|
||||
--COALESCE(dd.updated_at, dd.created_at) AS postponement_date,
|
||||
dd.recruit_id,
|
||||
dd.postponement_date,
|
||||
COALESCE(r.current_recruitment_id, r.target_recruitment_id) AS recruitment_id,
|
||||
ROW_NUMBER() OVER (PARTITION BY dd.recruit_id ORDER BY COALESCE(dd.system_update_date, dd.system_create_date) DESC) AS rn
|
||||
FROM recruits r
|
||||
JOIN recruits_deferment dd ON dd.recruit_id = r.id
|
||||
WHERE COALESCE(r.current_recruitment_id, r.target_recruitment_id)::uuid IN (SELECT recruitment_id FROM ids)
|
||||
),
|
||||
last_status AS(
|
||||
SELECT *
|
||||
FROM vse
|
||||
WHERE rn = 1
|
||||
)
|
||||
SELECT
|
||||
COALESCE(COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'false'), 0) AS postponement_have_right,
|
||||
CASE
|
||||
WHEN (ls.postponement_date > DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '6 months' + INTERVAL '14 days')
|
||||
THEN 'Весна'
|
||||
WHEN (ls.postponement_date > DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '12 months')
|
||||
THEN 'Осень'
|
||||
END AS spring_autumn,
|
||||
ls.recruitment_id,
|
||||
current_date AS recording_date
|
||||
FROM last_status ls
|
||||
WHERE ls.recruitment_id IS NOT NULL
|
||||
AND ls.postponement_date > DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '12 months'
|
||||
GROUP BY spring_autumn, ls.recruitment_id</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>464</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Update</name>
|
||||
<type>Update</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>100</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<error_ignored>Y</error_ignored>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>recruitment_id</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>spring_autumn</field>
|
||||
<name>spring_autumn</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recording_date</field>
|
||||
<name>recording_date</name>
|
||||
</key>
|
||||
<schema>main_dashboard</schema>
|
||||
<table>recruitment_campaign</table>
|
||||
<value>
|
||||
<name>postponement_have_right</name>
|
||||
<rename>postponement_have_right</rename>
|
||||
</value>
|
||||
</lookup>
|
||||
<skip_lookup>N</skip_lookup>
|
||||
<use_batch>Y</use_batch>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1056</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
</transform_error_handling>
|
||||
<attributes/>
|
||||
</pipeline>
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<pipeline>
|
||||
<info>
|
||||
<name>m_d.rec_cam(m_c)_to_person_registry_postponement_uniq</name>
|
||||
<name_sync_with_filename>Y</name_sync_with_filename>
|
||||
<description/>
|
||||
<extended_description/>
|
||||
<pipeline_version/>
|
||||
<pipeline_type>Normal</pipeline_type>
|
||||
<pipeline_status>0</pipeline_status>
|
||||
<parameters>
|
||||
</parameters>
|
||||
<capture_transform_performance>N</capture_transform_performance>
|
||||
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
|
||||
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
|
||||
<created_user>-</created_user>
|
||||
<created_date>2024/08/02 11:56:22.507</created_date>
|
||||
<modified_user>-</modified_user>
|
||||
<modified_date>2024/08/02 11:56:22.507</modified_date>
|
||||
</info>
|
||||
<notepads>
|
||||
</notepads>
|
||||
<order>
|
||||
<hop>
|
||||
<from>Table input (person_registry) регион/осень</from>
|
||||
<to>Update</to>
|
||||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Table input (person_registry) регион/осень</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>postgres.person_registry</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>WITH
|
||||
ids AS (
|
||||
-- Весенние ID
|
||||
SELECT unnest(string_to_array(nullif(trim(both '{}' from '${ARR_MC_SP}'), ''), ','))::uuid AS recruitment_id,
|
||||
'Весна' AS spring_autumn
|
||||
UNION ALL
|
||||
-- Осенние ID
|
||||
SELECT unnest(string_to_array(nullif(trim(both '{}' from '${ARR_MC_AU}'), ''), ','))::uuid AS recruitment_id,
|
||||
'Осень' AS spring_autumn
|
||||
),
|
||||
vse AS(
|
||||
SELECT
|
||||
CASE
|
||||
WHEN dd.hidden is true THEN 'true'
|
||||
ELSE 'false'
|
||||
END AS postponement,
|
||||
--COALESCE(dd.updated_at, dd.created_at) AS postponement_date,
|
||||
dd.recruit_id,
|
||||
dd.postponement_date,
|
||||
COALESCE(r.current_recruitment_id, r.target_recruitment_id) AS recruitment_id,
|
||||
ROW_NUMBER() OVER (PARTITION BY dd.recruit_id ORDER BY COALESCE(dd.system_update_date, dd.system_create_date) DESC) AS rn
|
||||
FROM recruits r
|
||||
JOIN recruits_deferment dd ON dd.recruit_id = r.id
|
||||
WHERE COALESCE(r.current_recruitment_id, r.target_recruitment_id)::uuid IN (SELECT recruitment_id FROM ids WHERE spring_autumn = 'Весна')
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
CASE
|
||||
WHEN dd.hidden is true THEN 'true'
|
||||
ELSE 'false'
|
||||
END AS postponement,
|
||||
--COALESCE(dd.updated_at, dd.created_at) AS postponement_date,
|
||||
dd.recruit_id,
|
||||
dd.postponement_date,
|
||||
COALESCE(r.current_recruitment_id, r.target_recruitment_id) AS recruitment_id,
|
||||
ROW_NUMBER() OVER (PARTITION BY dd.recruit_id ORDER BY COALESCE(dd.system_update_date, dd.system_create_date) DESC) AS rn
|
||||
FROM recruits r
|
||||
JOIN recruits_deferment dd ON dd.recruit_id = r.id
|
||||
WHERE COALESCE(r.current_recruitment_id, r.target_recruitment_id)::uuid IN (SELECT recruitment_id FROM ids WHERE spring_autumn = 'Осень')
|
||||
),
|
||||
last_status AS(
|
||||
SELECT *
|
||||
FROM vse
|
||||
WHERE rn = 1
|
||||
)
|
||||
SELECT
|
||||
COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'true') AS postponement_have_right,
|
||||
--COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'false') AS postponement_granted,
|
||||
'Весна' AS spring_autumn,
|
||||
ls.recruitment_id,
|
||||
CURRENT_DATE AS recording_date
|
||||
FROM last_status ls
|
||||
WHERE ls.recruitment_id IS NOT NULL
|
||||
AND ls.postponement_date > DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '6 months' + INTERVAL '14 days' -- 15 июля текущего года
|
||||
AND ls.season = 'Весна'
|
||||
GROUP BY ls.recruitment_id
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'true') AS postponement_have_right,
|
||||
--COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'false') AS postponement_granted,
|
||||
'Осень' AS spring_autumn,
|
||||
ls.recruitment_id,
|
||||
CURRENT_DATE AS recording_date
|
||||
FROM last_status ls
|
||||
WHERE ls.recruitment_id IS NOT NULL
|
||||
AND ls.postponement_date > DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '12 months' -- 1 января следующего года
|
||||
AND ls.season = 'Осень'
|
||||
GROUP BY ls.recruitment_id;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>464</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Update</name>
|
||||
<type>Update</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<commit>100</commit>
|
||||
<connection>ervu-dashboard</connection>
|
||||
<error_ignored>N</error_ignored>
|
||||
<lookup>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recruitment_id</field>
|
||||
<name>recruitment_id</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>spring_autumn</field>
|
||||
<name>spring_autumn</name>
|
||||
</key>
|
||||
<key>
|
||||
<condition>=</condition>
|
||||
<field>recording_date</field>
|
||||
<name>recording_date</name>
|
||||
</key>
|
||||
<schema>main_dashboard</schema>
|
||||
<table>recruitment_campaign</table>
|
||||
<value>
|
||||
<name>postponement_have_right</name>
|
||||
<rename>postponement_have_right</rename>
|
||||
</value>
|
||||
</lookup>
|
||||
<skip_lookup>N</skip_lookup>
|
||||
<use_batch>N</use_batch>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>1024</xloc>
|
||||
<yloc>320</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
</transform_error_handling>
|
||||
<attributes/>
|
||||
</pipeline>
|
||||
Loading…
Add table
Add a link
Reference in a new issue