From b9c5fb9e34239e5aef1c2b0a301ed1b8ffab4ba0 Mon Sep 17 00:00:00 2001 From: Guiqiang Zhang Date: Tue, 12 May 2020 00:07:36 +0800 Subject: [PATCH 1/6] revise queries --- .../get_marathon_matches_for_challenge_details.sql | 2 +- .../get_marathon_matches_for_challenge_listing.sql | 2 +- src/main/resources/sql/mmatches-feeder/get_mmatches.sql | 2 +- src/main/resources/sql/mmatches-feeder/get_user_ids.sql | 2 +- .../mmatches-feeder/job/get_mm_registration_phase_started.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql index 8139528..c2fbea5 100644 --- a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql +++ b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql @@ -13,4 +13,4 @@ left join informixoltp\:round_component rc on r.round_id = rc.round_id left join informixoltp\:component c on rc.component_id = c.component_id left join tcs_catalog\:project_info pi on pi.project_info_type_id = 56 and pi.value::decimal = r.round_id left join informixoltp\:round_segment rs on rs.round_id = r.round_id and rs.segment_id = 5 -where pi.project_id is null and r.round_type_id = 13 and {filter} \ No newline at end of file +where pi.project_id is null and r.round_type_id in (13, 19) and {filter} \ No newline at end of file diff --git a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql index 3b9a08e..65ef2f3 100644 --- a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql +++ b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql @@ -29,4 +29,4 @@ left join informixoltp\:component comp on comp.component_id = rc.component_id left join informixoltp\:round_segment rs_reg on rs_reg.round_id = r.round_id and rs_reg.segment_id = 1 left join informixoltp\:round_segment rs_sub on rs_sub.round_id = r.round_id and rs_sub.segment_id = 2 left join tcs_catalog\:project_info pi on pi.project_info_type_id = 56 and pi.value::decimal = r.round_id -where pi.project_id is null and r.round_type_id = 13 and {filter} \ No newline at end of file +where pi.project_id is null and r.round_type_id in (13, 19) and {filter} \ No newline at end of file diff --git a/src/main/resources/sql/mmatches-feeder/get_mmatches.sql b/src/main/resources/sql/mmatches-feeder/get_mmatches.sql index 8a9f822..4989452 100644 --- a/src/main/resources/sql/mmatches-feeder/get_mmatches.sql +++ b/src/main/resources/sql/mmatches-feeder/get_mmatches.sql @@ -61,5 +61,5 @@ FROM INFORMIXOLTP\:problem AS problem ON problem.problem_id = component.problem_id WHERE - round.round_type_id = 13 + round.round_type_id in (13, 19) AND {filter} diff --git a/src/main/resources/sql/mmatches-feeder/get_user_ids.sql b/src/main/resources/sql/mmatches-feeder/get_user_ids.sql index 661783f..7c46674 100644 --- a/src/main/resources/sql/mmatches-feeder/get_user_ids.sql +++ b/src/main/resources/sql/mmatches-feeder/get_user_ids.sql @@ -19,4 +19,4 @@ FROM tcs_catalog\:user AS user_table ON user_table.user_id = round_registration.coder_id WHERE - round.round_type_id = 13 AND {filter} \ No newline at end of file + round.round_type_id in (13, 19) AND {filter} \ No newline at end of file diff --git a/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql b/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql index 1e3eedb..3f8c546 100644 --- a/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql +++ b/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql @@ -7,7 +7,7 @@ FROM AND registration_segment.segment_id = 1 LEFT JOIN tcs_catalog\:project_info pi on pi.project_info_type_id = 56 and pi.value::decimal = round.round_id WHERE - pi.project_id is null AND round.round_type_id = 13 + pi.project_id is null AND round.round_type_id in (13,19) AND ( (1 = :lastRunTimestamp) OR From b2228bb67481e54e21a716dda7456cf1e1ba2203 Mon Sep 17 00:00:00 2001 From: Guiqiang Zhang Date: Tue, 12 May 2020 07:28:25 +0800 Subject: [PATCH 2/6] support for round type ids --- .../get_marathon_matches_for_challenge_details.sql | 2 +- .../get_marathon_matches_for_challenge_listing.sql | 2 +- src/main/resources/sql/mmatches-feeder/get_mmatches.sql | 2 +- src/main/resources/sql/mmatches-feeder/get_user_ids.sql | 2 +- .../mmatches-feeder/job/get_mm_registration_phase_started.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql index c2fbea5..1c65c80 100644 --- a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql +++ b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_details.sql @@ -13,4 +13,4 @@ left join informixoltp\:round_component rc on r.round_id = rc.round_id left join informixoltp\:component c on rc.component_id = c.component_id left join tcs_catalog\:project_info pi on pi.project_info_type_id = 56 and pi.value::decimal = r.round_id left join informixoltp\:round_segment rs on rs.round_id = r.round_id and rs.segment_id = 5 -where pi.project_id is null and r.round_type_id in (13, 19) and {filter} \ No newline at end of file +where pi.project_id is null and r.round_type_id in (13, 15, 16, 19, 22, 23) and {filter} \ No newline at end of file diff --git a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql index 65ef2f3..86a6705 100644 --- a/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql +++ b/src/main/resources/sql/mm-feeder-into-challenges/get_marathon_matches_for_challenge_listing.sql @@ -29,4 +29,4 @@ left join informixoltp\:component comp on comp.component_id = rc.component_id left join informixoltp\:round_segment rs_reg on rs_reg.round_id = r.round_id and rs_reg.segment_id = 1 left join informixoltp\:round_segment rs_sub on rs_sub.round_id = r.round_id and rs_sub.segment_id = 2 left join tcs_catalog\:project_info pi on pi.project_info_type_id = 56 and pi.value::decimal = r.round_id -where pi.project_id is null and r.round_type_id in (13, 19) and {filter} \ No newline at end of file +where pi.project_id is null and r.round_type_id in (13, 15, 16, 19, 22, 23) and {filter} \ No newline at end of file diff --git a/src/main/resources/sql/mmatches-feeder/get_mmatches.sql b/src/main/resources/sql/mmatches-feeder/get_mmatches.sql index 4989452..5c8c55d 100644 --- a/src/main/resources/sql/mmatches-feeder/get_mmatches.sql +++ b/src/main/resources/sql/mmatches-feeder/get_mmatches.sql @@ -61,5 +61,5 @@ FROM INFORMIXOLTP\:problem AS problem ON problem.problem_id = component.problem_id WHERE - round.round_type_id in (13, 19) + round.round_type_id in (13, 15, 16, 19, 22, 23) AND {filter} diff --git a/src/main/resources/sql/mmatches-feeder/get_user_ids.sql b/src/main/resources/sql/mmatches-feeder/get_user_ids.sql index 7c46674..2e0dd56 100644 --- a/src/main/resources/sql/mmatches-feeder/get_user_ids.sql +++ b/src/main/resources/sql/mmatches-feeder/get_user_ids.sql @@ -19,4 +19,4 @@ FROM tcs_catalog\:user AS user_table ON user_table.user_id = round_registration.coder_id WHERE - round.round_type_id in (13, 19) AND {filter} \ No newline at end of file + round.round_type_id in (13, 15, 16, 19, 22, 23) AND {filter} \ No newline at end of file diff --git a/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql b/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql index 3f8c546..0278d7b 100644 --- a/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql +++ b/src/main/resources/sql/mmatches-feeder/job/get_mm_registration_phase_started.sql @@ -7,7 +7,7 @@ FROM AND registration_segment.segment_id = 1 LEFT JOIN tcs_catalog\:project_info pi on pi.project_info_type_id = 56 and pi.value::decimal = round.round_id WHERE - pi.project_id is null AND round.round_type_id in (13,19) + pi.project_id is null AND round.round_type_id in (13, 15, 16, 19, 22, 23 ) AND ( (1 = :lastRunTimestamp) OR From ab954b096ae797b482b425d3eaa07cf76d501b34 Mon Sep 17 00:00:00 2001 From: FireIce Date: Wed, 13 May 2020 12:43:18 +0800 Subject: [PATCH 3/6] fix NullPointerException --- .../challengefeeder/manager/ChallengeDetailMMFeederManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java index d92f9b3..140992e 100644 --- a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java +++ b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java @@ -123,7 +123,7 @@ private static void associateAllSubmissions(List challenges Double proveScore = 0.0; for (int i = 0; i < provisionalResult.size(); i++) { provRankNoTie++; - if (!proveScore.equals(provisionalResult.get(i).getProvisionalScore())) { + if (proveScore == null || provisionalResult.get(i).getProvisionalScore() || !proveScore.equals(provisionalResult.get(i).getProvisionalScore())) { provRank = provRankNoTie; } proveScore = provisionalResult.get(i).getProvisionalScore(); From f4c9059d2a1511d92e31bdbd4b2cdc583a3726f0 Mon Sep 17 00:00:00 2001 From: FireIce Date: Wed, 13 May 2020 12:52:30 +0800 Subject: [PATCH 4/6] fix compilation issue --- .../challengefeeder/manager/ChallengeDetailMMFeederManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java index 140992e..d4d09bf 100644 --- a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java +++ b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java @@ -123,7 +123,7 @@ private static void associateAllSubmissions(List challenges Double proveScore = 0.0; for (int i = 0; i < provisionalResult.size(); i++) { provRankNoTie++; - if (proveScore == null || provisionalResult.get(i).getProvisionalScore() || !proveScore.equals(provisionalResult.get(i).getProvisionalScore())) { + if (proveScore == null || provisionalResult.get(i).getProvisionalScore() == null || !proveScore.equals(provisionalResult.get(i).getProvisionalScore())) { provRank = provRankNoTie; } proveScore = provisionalResult.get(i).getProvisionalScore(); From 43b29bf7c800a64b7c06516581ba6b9bd7c1afcc Mon Sep 17 00:00:00 2001 From: FireIce Date: Wed, 13 May 2020 13:19:55 +0800 Subject: [PATCH 5/6] fix Comparison method violates its general contract! issue --- .../manager/ChallengeDetailMMFeederManager.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java index d4d09bf..d78ba8c 100644 --- a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java +++ b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java @@ -173,6 +173,18 @@ private static void associateAllSubmissions(List challenges } userSubmissions.sort((UserSubmissionData usd1, UserSubmissionData usd2) -> { + if (usd1 == null and usd2 == null) { + return 0; + } + + if(usd1 == null) { + return 1; + } + + if(usd2== null) { + return -1; + } + Double r1; Double r2; if (c.getIsSysTestCompleted()) { @@ -182,6 +194,11 @@ private static void associateAllSubmissions(List challenges r1 = (usd1.getSubmissions().size() > 0) ? usd1.getSubmissions().get(0).getFinalScore() : null; r2 = (usd2.getSubmissions().size() > 0) ? usd2.getSubmissions().get(0).getFinalScore() : null; } + + if (r1 == null && r2 == null) { + return 0; + } + if (r1 == null) return 1; if (r2 == null) return -1; if (r1 > r2) { From df21e1188c0ca2e8cd5e678abddc2c7f9d97da76 Mon Sep 17 00:00:00 2001 From: FireIce Date: Wed, 13 May 2020 13:23:09 +0800 Subject: [PATCH 6/6] fix compilation issue --- .../challengefeeder/manager/ChallengeDetailMMFeederManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java index d78ba8c..3471190 100644 --- a/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java +++ b/src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java @@ -173,7 +173,7 @@ private static void associateAllSubmissions(List challenges } userSubmissions.sort((UserSubmissionData usd1, UserSubmissionData usd2) -> { - if (usd1 == null and usd2 == null) { + if (usd1 == null && usd2 == null) { return 0; }