This commit is contained in:
Ruslan 2025-03-21 11:06:52 +03:00
parent aef3ae94d8
commit c6de11c9f0
3 changed files with 52 additions and 221 deletions

View file

@ -21,116 +21,12 @@
<notepads>
</notepads>
<order>
<hop>
<from>Table input отчрочки из decisions</from>
<to>Insert / update (main_dashboard.recruitment_campaign)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input отчрочки из decisions</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update (main_dashboard.recruitment_campaign)</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruitment_id</field>
<name>recruitment_id</name>
</key>
<key>
<condition>=</condition>
<field>recording_date</field>
<name>recording_date</name>
</key>
<key>
<condition>=</condition>
<field>spring_autumn</field>
<name>spring_autumn</name>
</key>
<schema>main_dashboard</schema>
<table>recruitment_campaign</table>
<value>
<name>subpoenas_sent</name>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared_on_subpoenas</name>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared_on_subpoenas</name>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
<name>new_recruits</name>
<rename>new_recruits</rename>
<update>Y</update>
</value>
<value>
<name>postponement_have_right</name>
<rename>postponement_have_right</rename>
<update>Y</update>
</value>
<value>
<name>postponement_granted</name>
<rename>postponement_granted</rename>
<update>Y</update>
</value>
<value>
<name>appeared_on_subpoenas_percent</name>
<rename>appeared_on_subpoenas_percent</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared_on_subpoenas_percent</name>
<rename>not_appeared_on_subpoenas_percent</rename>
<update>Y</update>
</value>
<value>
<name>postponement_have_right_percent</name>
<rename>postponement_have_right_percent</rename>
<update>Y</update>
</value>
<value>
<name>postponement_granted_percent</name>
<rename>postponement_granted_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>spring_autumn</name>
<rename>spring_autumn</rename>
<update>N</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>992</xloc>
<yloc>608</yloc>
</GUI>
</transform>
<transform>
<name>Table input отчрочки из decisions</name>
<type>TableInput</type>
@ -170,19 +66,23 @@ last_status AS(
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,
COALESCE(COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'true'), 0) AS postponement_have_right,
COALESCE(COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'false'), 0) AS postponement_granted,
--COALESCE((COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'true') * 100 / NULLIF(COUNT(ls.postponement), 0)), 0) AS postponement_have_right_percent,
--COALESCE((COUNT(ls.postponement) FILTER (WHERE ls.postponement = 'false') * 100 / NULLIF(COUNT(ls.postponement), 0)), 0) AS postponement_granted_percent,
CASE
WHEN EXTRACT(MONTH FROM ls.postponement_date) BETWEEN 1 AND 6 THEN 'Весна'
WHEN EXTRACT(MONTH FROM ls.postponement_date) BETWEEN 7 AND 12 THEN 'Осень'
WHEN (ls.postponement_date BETWEEN DATE_TRUNC('year', ls.postponement_date) + INTERVAL '3 months' + INTERVAL '1 day'
AND DATE_TRUNC('year', ls.postponement_date) + INTERVAL '6 months' + INTERVAL '15 days')
THEN 'Весна'
WHEN (ls.postponement_date BETWEEN DATE_TRUNC('year', ls.postponement_date) + INTERVAL '9 months' + INTERVAL '1 day'
AND DATE_TRUNC('year', ls.postponement_date) + INTERVAL '12 months' + INTERVAL '31 days')
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)
--AND ls.postponement_date >= DATE_TRUNC('year', CURRENT_DATE)
GROUP BY spring_autumn, ls.recruitment_id</sql>
<variables_active>Y</variables_active>
<attributes/>
@ -205,21 +105,25 @@ GROUP BY spring_autumn, ls.recruitment_id</sql>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<error_ignored>Y</error_ignored>
<ignore_flag_field/>
<lookup>
<key>
<condition>=</condition>
<field>recruitment_id</field>
<name>recruitment_id</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>main_dashboard</schema>
<table>recruitment_campaign</table>

View file

@ -24,6 +24,11 @@
<hop>
<from>Table input (person_registry) регион/осень</from>
<to>Insert / update (main_dashboard.recruitment_campaign)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) регион/осень</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
@ -45,19 +50,16 @@
<condition>=</condition>
<field>recruitment_id</field>
<name>recruitment_id</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>recording_date</field>
<name>recording_date</name>
<name2/>
</key>
<key>
<condition>=</condition>
<field>spring_autumn</field>
<name>spring_autumn</name>
<name2/>
</key>
<schema>main_dashboard</schema>
<table>recruitment_campaign</table>
@ -81,7 +83,7 @@
<attributes/>
<GUI>
<xloc>1008</xloc>
<yloc>320</yloc>
<yloc>512</yloc>
</GUI>
</transform>
<transform>
@ -121,6 +123,31 @@ CROSS JOIN season_separations ss</sql>
<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>
<error_ignored>N</error_ignored>
<lookup>
<schema/>
<table>lookup table</table>
</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/>

View file

@ -21,116 +21,12 @@
<notepads>
</notepads>
<order>
<hop>
<from>Table input (subpoena) регион/осень</from>
<to>Insert / update (main_dashboard.recruitment_campaign)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (subpoena) регион/осень</from>
<to>Update</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update (main_dashboard.recruitment_campaign)</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruitment_id</field>
<name>recruitment_id</name>
</key>
<key>
<condition>=</condition>
<field>recording_date</field>
<name>recording_date</name>
</key>
<key>
<condition>=</condition>
<field>spring_autumn</field>
<name>spring_autumn</name>
</key>
<schema>main_dashboard</schema>
<table>recruitment_campaign</table>
<value>
<name>subpoenas_sent</name>
<rename>count_subpoena</rename>
<update>Y</update>
</value>
<value>
<name>appeared_on_subpoenas</name>
<rename>count_appeared</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared_on_subpoenas</name>
<rename>count_not_appeared</rename>
<update>Y</update>
</value>
<value>
<name>new_recruits</name>
<rename>new_recruits</rename>
<update>Y</update>
</value>
<value>
<name>postponement_have_right</name>
<rename>postponement_have_right</rename>
<update>Y</update>
</value>
<value>
<name>postponement_granted</name>
<rename>postponement_granted</rename>
<update>Y</update>
</value>
<value>
<name>appeared_on_subpoenas_percent</name>
<rename>appeared_on_subpoenas_percent</rename>
<update>Y</update>
</value>
<value>
<name>not_appeared_on_subpoenas_percent</name>
<rename>not_appeared_on_subpoenas_percent</rename>
<update>Y</update>
</value>
<value>
<name>postponement_have_right_percent</name>
<rename>postponement_have_right_percent</rename>
<update>Y</update>
</value>
<value>
<name>postponement_granted_percent</name>
<rename>postponement_granted_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>spring_autumn</name>
<rename>spring_autumn</rename>
<update>N</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>928</xloc>
<yloc>544</yloc>
</GUI>
</transform>
<transform>
<name>Table input (subpoena) регион/осень</name>
<type>TableInput</type>
@ -189,7 +85,7 @@ last_status AS (
WHERE rn = 1
),
season_separations AS (
SELECT distinct
SELECT DISTINCT
ls.recruitment_id,
ls.create_date,
ls.sub_stat_hist,
@ -202,8 +98,12 @@ season_separations AS (
ls.act_number,
ls.rdi_id,
CASE
WHEN EXTRACT(MONTH FROM ls.create_date) BETWEEN 1 AND 6 THEN 'Весна'
WHEN EXTRACT(MONTH FROM ls.create_date) BETWEEN 7 AND 12 THEN 'Осень'
WHEN (ls.create_date BETWEEN DATE_TRUNC('year', ls.create_date) + INTERVAL '3 months' + INTERVAL '1 day'
AND DATE_TRUNC('year', ls.create_date) + INTERVAL '6 months' + INTERVAL '15 days')
THEN 'Весна'
WHEN (ls.create_date BETWEEN DATE_TRUNC('year', ls.create_date) + INTERVAL '9 months' + INTERVAL '1 day'
AND DATE_TRUNC('year', ls.create_date) + INTERVAL '12 months' + INTERVAL '31 days')
THEN 'Осень'
END AS spring_autumn
FROM last_status ls
--WHERE ls.create_date >= DATE_TRUNC('year', CURRENT_DATE)
@ -255,7 +155,7 @@ SELECT
FROM season_separations_clean ss
LEFT JOIN t1 ON ss.recruitment_id = t1.recruitment_id AND ss.spring_autumn = t1.spring_autumn
LEFT JOIN t2 ON ss.recruitment_id = t2.recruitment_id AND ss.spring_autumn = t2.spring_autumn
LEFT JOIN t3 ON ss.recruitment_id = t3.recruitment_id AND ss.spring_autumn = t3.spring_autumn;</sql>
LEFT JOIN t3 ON ss.recruitment_id = t3.recruitment_id AND ss.spring_autumn = t3.spring_autumn</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>