Skip to content

Change Query to exclude non tco projects from computation #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 31 additions & 13 deletions tco_setup/tco18_eligible_contests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ WHERE p.project_status_id = 1
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.project_id not in (30059771) -- exceptions to exclude
-- and mod(p.project_id, 2) = 0;
and 1=1;

Expand All @@ -40,6 +41,7 @@ WHERE p.project_status_id = 1
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.project_id not in (30059771) -- exceptions to exclude
-- and mod(p.project_id, 2) = 0;
and 1=1;

Expand All @@ -49,7 +51,7 @@ insert into contest_project_xref
SELECT 655, p.project_id, current
FROM project p
INNER JOIN project_phase pp ON p.project_id = pp.project_id and pp.phase_type_id = 1 and
pp.actual_start_time >= '2018-01-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
pp.actual_start_time >= '2018-02-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
INNER JOIN project_info pi12 ON p.project_id = pi12.project_id and pi12.project_info_type_id = 12 and pi12.value = 'Yes'
INNER JOIN project_info pi13 ON p.project_id = pi13.project_id and pi13.project_info_type_id = 13 and (pi13.value = 'Yes' or p.project_category_id = 39) -- Code challenges are included even if not rated
INNER JOIN project_info pi14 ON p.project_id = pi14.project_id and pi14.project_info_type_id = 14 and pi14.value = 'Open'
Expand All @@ -60,7 +62,9 @@ WHERE p.project_status_id = 1
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.project_id not in (30057468, 30057606); -- exclude specific challenges
and p.project_id not in (30057468, 30057606) -- exclude specific challenges
and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407) -- exclude projects for fun and university challenges
and 1=1;
-- and mod(p.project_id, 2) = 0;

-- Stage 4
Expand All @@ -79,7 +83,9 @@ WHERE p.project_status_id = 1
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.project_id not in (30057968); -- exclude specific challenges
and p.project_id not in (30057968) -- exclude specific challenges
and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407)-- exclude projects for fun and university challenges
and 1 = 1;
-- and mod(p.project_id, 2) = 0;


Expand Down Expand Up @@ -129,7 +135,7 @@ insert into contest_project_xref
SELECT 650, p.project_id, current
FROM project p
INNER JOIN project_phase pp ON p.project_id = pp.project_id and pp.phase_type_id = 1 and
pp.actual_start_time >= '2018-01-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
pp.actual_start_time >= '2018-02-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
INNER JOIN project_info pi12 ON p.project_id = pi12.project_id and pi12.project_info_type_id = 12 and pi12.value = 'Yes'
INNER JOIN project_info pi13 ON p.project_id = pi13.project_id and pi13.project_info_type_id = 13 and pi13.value = 'Yes'
INNER JOIN project_info pi14 ON p.project_id = pi14.project_id and pi14.project_info_type_id = 14 and pi14.value = 'Open'
Expand All @@ -139,7 +145,9 @@ WHERE p.project_status_id = 1
and p.project_id not in (select project_id from contest_project_xref where contest_id in (650, 583)) -- make sure we exclude from tco
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%'; -- exclude IBM Cognitive Community Segment
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407)-- exclude projects for fun and university challenges
and 1 = 1;
-- and mod(p.project_id, 2) = 0;

-- Stage 4
Expand All @@ -157,7 +165,9 @@ WHERE p.project_status_id = 1
and p.project_id not in (select project_id from contest_project_xref where contest_id in (651, 583)) -- make sure we exclude from tco
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%'; -- exclude IBM Cognitive Community Segment
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407)-- exclude projects for fun and university challenges
and 1 = 1;
-- and mod(p.project_id, 2) = 0;


Expand Down Expand Up @@ -205,7 +215,7 @@ insert into contest_project_xref
SELECT 645, p.project_id, current
FROM project p
INNER JOIN project_phase pp ON p.project_id = pp.project_id and pp.phase_type_id = 1 and
pp.actual_start_time >= '2018-01-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
pp.actual_start_time >= '2018-02-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
INNER JOIN project_info pi12 ON p.project_id = pi12.project_id and pi12.project_info_type_id = 12 and pi12.value = 'Yes'
INNER JOIN project_info pi14 ON p.project_id = pi14.project_id and pi14.project_info_type_id = 14 and pi14.value = 'Open'
LEFT OUTER JOIN project_info pi82 ON pi82.project_id = p.project_id and pi82.project_info_type_id = 82
Expand All @@ -215,7 +225,9 @@ WHERE p.project_status_id = 1
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.project_id not in (30057516); -- exclude specific challenges
and p.project_id not in (30057516) -- exclude specific challenges
and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407)-- exclude projects for fun and university challenges
and 1 = 1;
-- and mod(p.project_id, 2) = 0;


Expand All @@ -233,7 +245,10 @@ WHERE p.project_status_id = 1
and p.project_id not in (select project_id from contest_project_xref where contest_id in (646, 583)) -- make sure we exclude from tco
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%'; -- exclude IBM Cognitive Community Segment
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407) -- exclude projects for fun and university challenges
and 1 = 1;

-- and mod(p.project_id, 2) = 0;


Expand Down Expand Up @@ -280,7 +295,7 @@ insert into contest_project_xref
SELECT 640, p.project_id, current
FROM project p
INNER JOIN project_phase pp ON p.project_id = pp.project_id and pp.phase_type_id = 1 and
pp.actual_start_time >= '2018-01-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
pp.actual_start_time >= '2018-02-01 00:00:00.000' and pp.actual_start_time < '2018-05-01 00:00:00.000'
INNER JOIN project_info pi12 ON p.project_id = pi12.project_id and pi12.project_info_type_id = 12 and pi12.value = 'Yes'
INNER JOIN project_info pi14 ON p.project_id = pi14.project_id and pi14.project_info_type_id = 14 and pi14.value = 'Open'
LEFT OUTER JOIN project_info pi82 ON pi82.project_id = p.project_id and pi82.project_info_type_id = 82
Expand All @@ -289,8 +304,10 @@ WHERE p.project_status_id = 1
and p.project_id not in (select project_id from contest_project_xref where contest_id in (640, 583)) -- make sure we exclude from tco
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%'; -- exclude IBM Cognitive Community Segment
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
-- and mod(p.project_id, 2) = 0;
and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407)-- exclude projects for fun and university challenges
and 1 = 1;

-- Stage 4
insert into contest_project_xref
Expand All @@ -307,6 +324,7 @@ WHERE p.project_status_id = 1
and p.project_id not in (select ce.contest_id from contest_eligibility ce)
and NVL(pi82.value, 0) = 0 -- No TCO if these are tasks
and p.project_id not in (30057968,30057832,30057829,30057831) -- exclude specific challenges
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%'; -- exclude IBM Cognitive Community Segment
and (select lower(value) from project_info where project_id = p.project_id and project_info_type_id = 6) not like 'ibm cognitive%' -- exclude IBM Cognitive Community Segment
-- and mod(p.project_id, 2) = 0;

and p.tc_direct_project_id not in (16411, 16412, 16413, 16406, 16399, 16407)-- exclude projects for fun and university challenges
and 1 = 1;