From cc078bee97e5eca0c92250899c48d174bf94b8cc Mon Sep 17 00:00:00 2001 From: ajefts Date: Mon, 7 May 2018 11:14:41 -0400 Subject: [PATCH 01/95] added config for actian agreement --- .../controller/request/docusign/docusign.xml | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml b/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml index 8c9b3423ddf..d3930564d2c 100644 --- a/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml +++ b/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml @@ -75,6 +75,9 @@ handlerForVetsAgreement + + handlerForActianNDAAgreement + @@ -247,19 +250,34 @@ - - com.topcoder.web.tc.controller.request.docusign.handlers.TermsOfUseHandler - - - - - long - - - 21263 + + com.topcoder.web.tc.controller.request.docusign.handlers.TermsOfUseHandler + + + + + long + + + 21263 + - + + + com.topcoder.web.tc.controller.request.docusign.handlers.TermsOfUseHandler + + + + + long + + + 21283 + + + + From 9eeb14f86a95b3d9e03a9b3125e18a30cd4e0dac Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 25 May 2018 12:39:29 -0400 Subject: [PATCH 02/95] send info to segment --- src/main/com/topcoder/web/jsp/foot.jsp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/com/topcoder/web/jsp/foot.jsp b/src/main/com/topcoder/web/jsp/foot.jsp index 764e500cea9..4149373c06e 100755 --- a/src/main/com/topcoder/web/jsp/foot.jsp +++ b/src/main/com/topcoder/web/jsp/foot.jsp @@ -160,6 +160,12 @@ }}(); + + From 816fffb2fc347023879de271d07b337bc22eaa40 Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 25 May 2018 14:01:27 -0400 Subject: [PATCH 03/95] fixed segment identify --- src/main/com/topcoder/web/jsp/foot.jsp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/com/topcoder/web/jsp/foot.jsp b/src/main/com/topcoder/web/jsp/foot.jsp index 4149373c06e..2c887390a32 100755 --- a/src/main/com/topcoder/web/jsp/foot.jsp +++ b/src/main/com/topcoder/web/jsp/foot.jsp @@ -161,8 +161,9 @@ From e509bbb729fca8a44bd61f67940fa4a3a172422a Mon Sep 17 00:00:00 2001 From: Ritesh Gupta Date: Thu, 4 Oct 2018 15:12:02 +0530 Subject: [PATCH 04/95] Added NDA terms handler for Eaton --- .../controller/request/docusign/docusign.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml b/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml index d3930564d2c..9b0b27e91b2 100644 --- a/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml +++ b/resources/com/topcoder/web/tc/controller/request/docusign/docusign.xml @@ -78,6 +78,9 @@ handlerForActianNDAAgreement + + handlerForEatonNDAAgreement + @@ -279,5 +282,20 @@ + + + com.topcoder.web.tc.controller.request.docusign.handlers.TermsOfUseHandler + + + + + long + + + 21313 + + + + From e1243099cd2e6983f11734bdfee21edbbe3426be Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 12 Oct 2018 14:40:39 -0400 Subject: [PATCH 05/95] added redirect to new learn page --- src/main/com/topcoder/web/tc/view/help/generalFaq.jsp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/com/topcoder/web/tc/view/help/generalFaq.jsp b/src/main/com/topcoder/web/tc/view/help/generalFaq.jsp index 49634436f51..bae8cc86719 100644 --- a/src/main/com/topcoder/web/tc/view/help/generalFaq.jsp +++ b/src/main/com/topcoder/web/tc/view/help/generalFaq.jsp @@ -11,6 +11,11 @@ +<% + String redirectURL = "https://www.topcoder.com/community/data-science/how-to-compete"; + response.sendRedirect(redirectURL); +%> + From 66c419636e94f2b9f19c6fc014afb27b5c3e5fe0 Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 12 Oct 2018 14:43:49 -0400 Subject: [PATCH 06/95] added redirect to new learn page --- .../web/codinginterface/longcontest/view/instructions.jsp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/com/topcoder/web/codinginterface/longcontest/view/instructions.jsp b/src/main/com/topcoder/web/codinginterface/longcontest/view/instructions.jsp index 58850ab3e93..4b09bcf66a5 100644 --- a/src/main/com/topcoder/web/codinginterface/longcontest/view/instructions.jsp +++ b/src/main/com/topcoder/web/codinginterface/longcontest/view/instructions.jsp @@ -11,6 +11,11 @@ +<% + String redirectURL = "https://www.topcoder.com/community/data-science/how-to-compete"; + response.sendRedirect(redirectURL); +%> + @@ -78,4 +83,4 @@ Once the submission phase of a Marathon Match has ended, the final results will - \ No newline at end of file + From 0f24f16fd8b3b5a7b905a8f9c0b57ba3a8870f83 Mon Sep 17 00:00:00 2001 From: ajefts Date: Mon, 17 Dec 2018 15:43:54 -0500 Subject: [PATCH 07/95] updated payment methods URL --- .../com/topcoder/web/tc/view/my_home/paymentPreferences.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp b/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp index d718feedd78..bb2f29bf22f 100644 --- a/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp +++ b/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp @@ -236,7 +236,7 @@ <% } %>
Have a question about - Payment Methods? + Payment Methods?
From 34b1ffbaa8feea36fded436e3f4000de0cc6b4ce Mon Sep 17 00:00:00 2001 From: ajefts Date: Mon, 17 Dec 2018 15:45:22 -0500 Subject: [PATCH 08/95] formatting update --- src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp b/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp index bb2f29bf22f..e726b572246 100644 --- a/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp +++ b/src/main/com/topcoder/web/tc/view/my_home/paymentPreferences.jsp @@ -235,6 +235,7 @@ <% } %> +
Have a question about Payment Methods?
From bfc2f225556e93e4c1cffbdd44f25dc241cff683 Mon Sep 17 00:00:00 2001 From: skyhit Date: Tue, 18 Dec 2018 09:27:53 +0000 Subject: [PATCH 09/95] make copyright year dynamic --- .../com/topcoder/web/common/render/ProblemRenderer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/com/topcoder/web/common/render/ProblemRenderer.java b/src/main/com/topcoder/web/common/render/ProblemRenderer.java index 4dc491f4532..7e77354b361 100755 --- a/src/main/com/topcoder/web/common/render/ProblemRenderer.java +++ b/src/main/com/topcoder/web/common/render/ProblemRenderer.java @@ -5,6 +5,7 @@ import com.topcoder.shared.problem.ElementRenderer; import com.topcoder.shared.problem.Problem; import com.topcoder.shared.problem.ProblemComponent; +import java.util.Calendar; import java.awt.*; @@ -18,7 +19,7 @@ public class ProblemRenderer extends BaseRenderer implements ElementRenderer { private Color backgroundColor = null; private Color foregroundColor = null; - private static final String LEGAL = "This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved. "; + private static final String LEGAL = "This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)%d, TopCoder, Inc. All rights reserved. "; public ProblemRenderer() { this.problem = null; @@ -67,7 +68,8 @@ public String toHTML(Language language) throws Exception { } } html.append("

"); - html.append(LEGAL); + int year = Calendar.getInstance().get(Calendar.YEAR); + html.append(String.format(LEGAL, year)); html.append("

"); return html.toString(); From 43d0b7a25edd4d96584ec97972db93bc18510826 Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 21 Dec 2018 15:34:05 -0500 Subject: [PATCH 10/95] added hardcoded exclusion for cmap --- .../longcontest/view/activeContests.jsp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp b/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp index 6784b925e8c..1c38e148012 100644 --- a/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp +++ b/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp @@ -86,6 +86,10 @@ <%boolean even = true;%> + +// EXCLUDE LEGACY CMAP MATCH + + "> <% pageContext.setAttribute("sponsorImage", ((LongContest) contest).getSponsorImage());%> @@ -149,7 +153,38 @@ <%even = !even;%> + +// ADDED TO EXCLUDE ROUNDS + + + +// ADDED TO SHOW NEW MATCH ON THE LEGACY PAGE + + +
+
+CMap: DPeak Challenge +
+ standings +
+ + + CMap: DPeak Challenge + + +Register + + + + + + + 12.14.2018
11:03 EST + 01.04.2019
08:58 EST + + + From 87b7e24048814868b126a15b5ff84ac21d59df08 Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 21 Dec 2018 16:09:57 -0500 Subject: [PATCH 11/95] updated comments --- .../web/codinginterface/longcontest/view/activeContests.jsp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp b/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp index 1c38e148012..41c67baa641 100644 --- a/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp +++ b/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp @@ -87,7 +87,7 @@ <%boolean even = true;%> -// EXCLUDE LEGACY CMAP MATCH + "> @@ -154,12 +154,12 @@ <%even = !even;%> -// ADDED TO EXCLUDE ROUNDS + -// ADDED TO SHOW NEW MATCH ON THE LEGACY PAGE +
From dbf2e571ef72037b8adbe8fdbdcb4e3372e868bf Mon Sep 17 00:00:00 2001 From: ajefts Date: Mon, 14 Jan 2019 20:39:01 -0500 Subject: [PATCH 12/95] Updated payment help link --- .../com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 685957f2881..e8a601baa70 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -117,11 +117,11 @@
<% if(isNewStyle) { %> <% } else { %>
- How to get paid + How to get paid
<% } %> From 1f4e848f3c2d8b6d58997be3373e655bb7ead624 Mon Sep 17 00:00:00 2001 From: ajefts Date: Mon, 14 Jan 2019 20:39:36 -0500 Subject: [PATCH 13/95] Updated payment help links --- .../topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp index 5ca9bfb6325..2e7a2bc4f5d 100644 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp @@ -53,7 +53,7 @@
- How to get paid + How to get paid
From d6e79bd2a6efeeed088139db0a6f83e13970353c Mon Sep 17 00:00:00 2001 From: Paulo Vitor Magacho da Silva Date: Wed, 16 Jan 2019 20:14:42 -0200 Subject: [PATCH 14/95] Updated to use TLS v1.2 --- .../topcoder/web/tc/controller/PayPalService.java | 15 ++++++++++++--- .../web/tc/controller/PayoneerService.java | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/main/com/topcoder/web/tc/controller/PayPalService.java b/src/main/com/topcoder/web/tc/controller/PayPalService.java index 98d402184fe..e1783e7ab97 100644 --- a/src/main/com/topcoder/web/tc/controller/PayPalService.java +++ b/src/main/com/topcoder/web/tc/controller/PayPalService.java @@ -20,6 +20,9 @@ import java.util.*; import java.io.*; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext;; + /** *

This class provides convenient static methods for calling the PayPal API.

* @@ -216,13 +219,19 @@ private static PayPalConfig getPayPalConfig() throws ConfigManagerException { *

A private helper method that queries the PayPal API with the specified parameters and returns the response.

*/ private static String getNVResponse(String url, String requestBody) throws Exception { - HttpURLConnection connection = null; + HttpsURLConnection connection = null; try { + SSLContext sc = SSLContext.getInstance("TLSv1.2"); + sc.init(null, null, new java.security.SecureRandom()); + PayPalConfig payPalConfig = getPayPalConfig(); - + + log.info("Using TLSv1.2"); + //Create connection - connection = (HttpURLConnection) (new URL(url)).openConnection(); + connection = (HttpsURLConnection) (new URL(url)).openConnection(); + connection.setSSLSocketFactory(sc.getSocketFactory()); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", "" + Integer.toString(requestBody.getBytes().length)); diff --git a/src/main/com/topcoder/web/tc/controller/PayoneerService.java b/src/main/com/topcoder/web/tc/controller/PayoneerService.java index 75f7d9bc273..1082b375879 100644 --- a/src/main/com/topcoder/web/tc/controller/PayoneerService.java +++ b/src/main/com/topcoder/web/tc/controller/PayoneerService.java @@ -23,6 +23,9 @@ import java.text.SimpleDateFormat; import java.util.*; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; + /** *

This class provides convenient static methods for calling the Payoneer API.

* @@ -291,9 +294,12 @@ private static PayoneerConfig getPayoneerConfig() throws ConfigManagerException *

This is a private helper method that queries the Payoneer API with the specified parameters and returns the response.

*/ private static Document getXMLResponse(String baseApiUrl, Map parameters) throws Exception { - HttpURLConnection connection = null; + HttpsURLConnection connection = null; try { + SSLContext sc = SSLContext.getInstance("TLSv1.2"); + sc.init(null, null, new java.security.SecureRandom()); + StringBuilder builder = new StringBuilder(); for(String key : parameters.keySet()) { if (builder.length() > 0) { @@ -305,9 +311,11 @@ private static Document getXMLResponse(String baseApiUrl, Map par // Log the request string but hide the password (which is the 'p2' parameter value). log.info("Payoneer request: " + urlParameters.replaceAll(parameters.get("p2"), "XXXXXXXX")); + log.info("Using TLSv1.2"); //Create connection - connection = (HttpURLConnection) (new URL(baseApiUrl)).openConnection(); + connection = (HttpsURLConnection) (new URL(baseApiUrl)).openConnection(); + connection.setSSLSocketFactory(sc.getSocketFactory()); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length)); From 708e4498df42b967817e268fc8f3c91a306dafeb Mon Sep 17 00:00:00 2001 From: Ritesh Gupta Date: Thu, 17 Jan 2019 20:22:58 +0530 Subject: [PATCH 15/95] Remove the DR points update query on source db --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 6c4629eb4f6..efb2f90ffce 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -1676,7 +1676,7 @@ public void doLoadProjects() throws Exception { " AND NOT pmd2.payment_status_id IN (65, 68, 69)), 0)) as review_cost" + ", (SELECT value::INTEGER FROM project_info piforum WHERE piforum.project_id = p.project_id and piforum.project_info_type_id = 4) as forum_id" + ", (select CASE when pi53.value == 'true' THEN 1 ELSE 0 END FROM project_info pi53 where pi53.project_info_type_id = 53 and pi53.project_id = p.project_id) as submission_viewable" + - ", NVL((SELECT 1 FROM contest_eligibility WHERE contest_id = p.project_id), 0) AS is_private" + + ", NVL((SELECT MIN(1) FROM contest_eligibility WHERE contest_id = p.project_id), 0) AS is_private" + // estimated_reliability_cost ",(CASE WHEN pire.value = 'true' THEN NVL((SELECT value::decimal FROM project_info pi38 WHERE pi38.project_id = p.project_id AND pi38.project_info_type_id = 38), 0) ELSE 0 END) as estimated_reliability_cost" + @@ -3336,8 +3336,10 @@ public void doLoadProjectResults() throws Exception { delete.executeUpdate(); // delete dr points for these projects. - deleteDrPoints = prepareStatement(delDrPointsQuery.toString(), SOURCE_DB); - deleteDrPoints.executeUpdate(); + // Jan 17, 2018 Remove the Delete DR points query to source database + // Source Db is TCS Mirror which is read only + //deleteDrPoints = prepareStatement(delDrPointsQuery.toString(), SOURCE_DB); + //deleteDrPoints.executeUpdate(); // get max dr points id From 345f32715771e16338f0a380022a8c405743495a Mon Sep 17 00:00:00 2001 From: Ritesh Gupta Date: Fri, 18 Jan 2019 15:22:58 +0530 Subject: [PATCH 16/95] Removed DR points insertion in Source db --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index efb2f90ffce..2273221c89e 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -3456,7 +3456,8 @@ public void doLoadProjectResults() throws Exception { drInsert.setBoolean(9, false); log.debug("Inserting DR points: " + t.getTrackId() + " - " + pr.getUserId() + " - " + pointsAwarded + " (" + projectResults.getInt("point_adjustment") + ")"); - drInsert.executeUpdate(); + //18th Jan, 2019, remove updates to source database, as its mirror + //drInsert.executeUpdate(); } else { log.debug("Awarded 0 points: " + t.getTrackId() + " - " + pr.getUserId() + " - " + pointsAwarded + " (" + projectResults.getInt("point_adjustment") + ")"); @@ -3476,7 +3477,8 @@ public void doLoadProjectResults() throws Exception { drInsert.setBoolean(9, true); log.debug("Inserting DR points: " + t.getTrackId() + " - " + pr.getUserId() + " - " + potentialPoints + " (" + projectResults.getInt("point_adjustment") + ")"); - drInsert.executeUpdate(); + //18th Jan, 2019, remove updates to source database, as its mirror + //drInsert.executeUpdate(); } else { log.debug("Potential 0 points: " + t.getTrackId() + " - " + pr.getUserId() + " - " + potentialPoints + " (" + projectResults.getInt("point_adjustment") + ")"); From cf74f77b9c9f63b935f51b89d19f1cd6aebf2884 Mon Sep 17 00:00:00 2001 From: Ritesh Gupta Date: Mon, 25 Feb 2019 11:27:12 +0530 Subject: [PATCH 17/95] Code Ratings Added --- .../dde/util/DWLoad/RatingQubits.java | 189 ++++++++++++++---- 1 file changed, 147 insertions(+), 42 deletions(-) diff --git a/src/main/com/topcoder/dde/util/DWLoad/RatingQubits.java b/src/main/com/topcoder/dde/util/DWLoad/RatingQubits.java index 14135147452..c34b308b44b 100755 --- a/src/main/com/topcoder/dde/util/DWLoad/RatingQubits.java +++ b/src/main/com/topcoder/dde/util/DWLoad/RatingQubits.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004 - 2009 TopCoder Inc., All Rights Reserved. + * Copyright (C) 2004 - 2018 TopCoder Inc., All Rights Reserved. */ package com.topcoder.dde.util.DWLoad; @@ -13,10 +13,7 @@ import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.TreeMap; -import java.util.Vector; +import java.util.*; import com.topcoder.shared.util.DBMS; import com.topcoder.shared.util.logging.Logger; @@ -42,8 +39,15 @@ * *

* - * @author pulky, VolodymyrK - * @version 1.2 + *

+ * Version 1.3 Change notes(Topcoder - Support Rating and Reliability Generation For Code Challenges in DWLoad): + *

    + *
  1. Added support for code challenge and load phase ids, cutoffs configurations from file.
  2. + *
+ *

+ * + * @author pulky, VolodymyrK,TCCODER + * @version 1.3 */ public class RatingQubits { private static final Logger log = Logger.getLogger(RatingQubits.class); @@ -52,6 +56,34 @@ public class RatingQubits { public static final String CONNECTION_URL_KEY = "ConnectionURL"; public static final String HISTORY_LENGTH_KEY = "HistoryLength"; + /** + * Property key name for phase ids + * + * @since 1.3 + */ + private static final String PHASE_IDS_KEY = "PhaseIds"; + + /** + * Property key name for cutoffs + * + * @since 1.3 + */ + private static final String CUT_OFFS_KEY = "CutOffs"; + + /** + * Property value for null value of cutoff + * + * @since 1.3 + */ + private static final String NULL_CUT_OFF = "null"; + + /** + * The simple date format for cut off. + * + * @since 1.3 + */ + private static final SimpleDateFormat SDF = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + private static final String NEW_PHASES_CUT_OFF = "03/23/2009 00:00:00"; private static final String UI_PROTOTYPE_CUT_OFF = "08/01/2009 00:00:00"; private static final String RIA_BUILD_CUT_OFF = "06/01/2010 00:00:00"; @@ -68,26 +100,37 @@ public class RatingQubits { private static final int RIA_BUILDS_PHASE_ID = 135; private static final int CONTENT_CREATION_PHASE_ID = 146; private static final int REPORTING_PHASE_ID = 147; + /** + * Code challenge phase id. + * + * @since 1.3 + */ + private static final int CODE_PHASE_ID = 150; private final static String NEW_RATING_STATUSES = "(4, 7, 8)"; /** * SQL fragment to be added to a where clause to not select projects with eligibility constraints - * + * * @since 1.1 */ private static final String ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT = " and p.project_id not in (select ce.contest_id from contest_eligibility ce " + - " where ce.is_studio = 0) "; + " where ce.is_studio = 0) "; /** * SQL fragment to be added to a where clause to select only rated projects - * + * * @since 1.2 */ private static final String RATED_CONSTRAINTS_SQL_FRAGMENT = " and p.project_id in (select pi.project_id from project_info pi where pi.project_info_type_id=13 " + - "and (pi.value='Yes' or pi.value='yes')) "; + "and (pi.value='Yes' or pi.value='yes')) "; + /** + * Load phase ids and cutoffs configurations from file + * @param args the command arguments + * @since 1.3 + */ public static void main(String[] args) { RatingQubits tmp = new RatingQubits(); @@ -113,6 +156,7 @@ public static void main(String[] args) { String jdbcDriver; String connectionURL; + Map projects = new HashMap(); try { jdbcDriver = config.getString(namespace, DRIVER_KEY); connectionURL = config.getString(namespace, CONNECTION_URL_KEY); @@ -126,6 +170,42 @@ public static void main(String[] args) { System.err.println("No Connection URL specified. (Config param '" + CONNECTION_URL_KEY + "')"); return; } + String[] phaseIds = config.getStringArray(namespace, PHASE_IDS_KEY); + String[] cutOffs = config.getStringArray(namespace, CUT_OFFS_KEY); + if (phaseIds!= null && cutOffs !=null) { + if (phaseIds.length != cutOffs.length) { + System.err.println("(Config param '" + PHASE_IDS_KEY + "')(" + phaseIds.length + ") and (Config param '" + + CUT_OFFS_KEY + "')("+ cutOffs.length + ") should have same length of string array"); + return; + } + for (int i = 0; i < phaseIds.length; i++) { + String id = phaseIds[i]; + int phaseId = -1; + try { + phaseId = Integer.parseInt(id); + } catch (NumberFormatException e) { + System.err.println("Invalid phase id value for "+ id + ", please check it"); + return; + } + if (projects.containsKey(phaseId)) { + System.err.println("(Config param '" + PHASE_IDS_KEY + "') contains duplicated phase id "+id); + return; + } + String cutoff = cutOffs[i]; + + Date cutoffDate = null; + try { + if (!NULL_CUT_OFF.equalsIgnoreCase(cutoff)){ + cutoffDate = new Date(SDF.parse(cutoff).getTime()); + } + } catch (ParseException e) { + e.printStackTrace(); + System.err.println("Invalid cutoff value " + cutoff + "for phase id "+ phaseId + ", please check it"); + return; + } + projects.put(phaseId, cutoffDate); + } + } } catch (UnknownNamespaceException e) { System.err.println("Initialized ConfigManager and namespace '" + namespace + "' without trouble but could not retrieve resource bundle"); return; @@ -137,7 +217,7 @@ public static void main(String[] args) { c = DriverManager.getConnection(connectionURL); c.setAutoCommit(true); - tmp.runAllScores(c, historyLength); + tmp.runAllScores(c, historyLength, projects); } catch (Exception e) { e.printStackTrace(); } finally { @@ -149,13 +229,18 @@ public static void main(String[] args) { } } - public void runAllScores(Connection conn, String historyLength) { - - SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + /** + * Run all score + * @param conn the database connection + * @param historyLength the length of history + * @param projects the projects map with keyis phase id and value is cut off date + * @since 1.3 + */ + public void runAllScores(Connection conn, String historyLength, Map projects) { Date newPhasesCutoff = null; try { - newPhasesCutoff = new Date(sdf.parse(NEW_PHASES_CUT_OFF).getTime()); + newPhasesCutoff = new Date(SDF.parse(NEW_PHASES_CUT_OFF).getTime()); } catch (ParseException e1) { System.err.println("Invalid value for constant NEW_PHASES_CUT_OFF, please check it"); return; @@ -163,7 +248,7 @@ public void runAllScores(Connection conn, String historyLength) { Date uiPrototypeCutoff = null; try { - uiPrototypeCutoff = new Date(sdf.parse(UI_PROTOTYPE_CUT_OFF).getTime()); + uiPrototypeCutoff = new Date(SDF.parse(UI_PROTOTYPE_CUT_OFF).getTime()); } catch (ParseException e1) { System.err.println("Invalid value for constant UI_PROTOTYPE_CUT_OFF, please check it"); return; @@ -171,24 +256,43 @@ public void runAllScores(Connection conn, String historyLength) { Date riaBuildCutoff = null; try { - riaBuildCutoff = new Date(sdf.parse(RIA_BUILD_CUT_OFF).getTime()); + riaBuildCutoff = new Date(SDF.parse(RIA_BUILD_CUT_OFF).getTime()); } catch (ParseException e1) { System.err.println("Invalid value for constant RIA_BUILD_CUT_OFF, please check it"); return; } - runScore(conn, historyLength, DESIGN_PHASE_ID); - runScore(conn, historyLength, DEV_PHASE_ID); - runScore(conn, historyLength, ASSEMBLY_PHASE_ID, newPhasesCutoff); - runScore(conn, historyLength, ARCHITECTURE_PHASE_ID, newPhasesCutoff); - runScore(conn, historyLength, SPECIFICATION_PHASE_ID, newPhasesCutoff); - runScore(conn, historyLength, CONCEPTUALIZATION_PHASE_ID, newPhasesCutoff); - runScore(conn, historyLength, TESTING_PHASE_ID, newPhasesCutoff); - runScore(conn, historyLength, TEST_SCENARIOS_PHASE_ID, newPhasesCutoff); - runScore(conn, historyLength, UI_PROTOTYPES_PHASE_ID, uiPrototypeCutoff); - runScore(conn, historyLength, RIA_BUILDS_PHASE_ID, riaBuildCutoff); - runScore(conn, historyLength, CONTENT_CREATION_PHASE_ID, riaBuildCutoff); - runScore(conn, historyLength, REPORTING_PHASE_ID, riaBuildCutoff); + for (Map.Entry entry : projects.entrySet()) { + runScore(conn, historyLength, entry.getKey(), entry.getValue()); + } + // phase ids without cut off + int[] phaseIds1 = new int [] { DESIGN_PHASE_ID, DEV_PHASE_ID } ; + for (int i = 0; i < phaseIds1.length; i++) { + if(!projects.containsKey(phaseIds1[i])) { + runScore(conn, historyLength, phaseIds1[i]); + } + } + + // phase ids with newPhasesCutoff + int[] phaseIds2 = new int [] { ASSEMBLY_PHASE_ID, ARCHITECTURE_PHASE_ID, SPECIFICATION_PHASE_ID, + CONCEPTUALIZATION_PHASE_ID, TESTING_PHASE_ID, TEST_SCENARIOS_PHASE_ID } ; + for (int i = 0; i < phaseIds2.length; i++) { + if(!projects.containsKey(phaseIds2[i])) { + runScore(conn, historyLength, phaseIds2[i], newPhasesCutoff); + } + } + + if (!projects.containsKey(UI_PROTOTYPES_PHASE_ID)) { + runScore(conn, historyLength, UI_PROTOTYPES_PHASE_ID, uiPrototypeCutoff); + } + + // phase ids with riaBuildCutoff + int[] phaseIds3 = new int [] { RIA_BUILDS_PHASE_ID, CONTENT_CREATION_PHASE_ID, REPORTING_PHASE_ID, CODE_PHASE_ID } ; + for (int i = 0; i < phaseIds3.length; i++) { + if(!projects.containsKey(phaseIds3[i])) { + runScore(conn, historyLength, phaseIds3[i], riaBuildCutoff); + } + } } // Run a score without a specific cut off time @@ -203,8 +307,11 @@ private void runScore(Connection conn, String historyLength, int phase) { * @param historyLength the history length * @param phase the phase * @param cutoff the cutoff date + * @since 1.3 */ private void runScore(Connection conn, String historyLength, int phase, Date cutoff) { + System.out.println("Run score for historyLength " + historyLength + " phase " + phase + + " cutoff " + ( cutoff == null ? NULL_CUT_OFF : SDF.format(cutoff))); PreparedStatement ps = null; ResultSet rs = null; @@ -216,7 +323,7 @@ private void runScore(Connection conn, String historyLength, int phase, Date cut "case when substr(pi_rd.value, 18,2)='PM' then round(substr(pi_rd.value, 12, 2)) +12 else round(substr(pi_rd.value, 12, 2)) end as hour " + "from project_result pr, project p, project_info pi_rd " ; if (cutoff != null) { - sqlStr += ", project_phase pp "; + sqlStr += ", project_phase pp "; } sqlStr += "where p.project_id = pr.project_id " + "and p.project_status_id in " + NEW_RATING_STATUSES + " " + @@ -227,11 +334,10 @@ private void runScore(Connection conn, String historyLength, int phase, Date cut RATED_CONSTRAINTS_SQL_FRAGMENT + "and pi_rd.project_id = p.project_id and pi_rd.project_info_type_id = 22 "; if (cutoff != null) { - sqlStr += "and pp.project_id = p.project_id and pp.phase_type_id = 1 " + - "and pp.actual_start_time > ? "; + sqlStr += "and pp.project_id = p.project_id and pp.phase_type_id = 1 " + + "and pp.actual_start_time > ? "; } sqlStr += "order by year, month, day, hour, 1"; - ps = conn.prepareStatement(sqlStr); ps.setInt(1, phase - 111); // Project Category if (cutoff != null) { @@ -969,13 +1075,13 @@ private double normsinv(double p) { private double normsinvnew(double p) { /* ******************************************** - * Original algorythm and Perl implementation can - * be found at: - * http://www.math.uio.no/~jacklam/notes/invnorm/index.html - * Author: - * Peter J. Acklam - * jacklam@math.uio.no - * ****************************************** */ + * Original algorythm and Perl implementation can + * be found at: + * http://www.math.uio.no/~jacklam/notes/invnorm/index.html + * Author: + * Peter J. Acklam + * jacklam@math.uio.no + * ****************************************** */ // Define break-points. // variable for result @@ -1107,4 +1213,3 @@ private double winprobability(double meana, double stddeva, double meanb, double //----------------------END RATING FUNCTIONS0----------------------------------------------- } - From bd60fb2b546a77d827489ced87fb15ce421eee96 Mon Sep 17 00:00:00 2001 From: Ritesh Gupta Date: Mon, 18 Mar 2019 17:11:12 +0530 Subject: [PATCH 18/95] Update RatingQubits.xml for Code Ratings --- scripts/dde/RatingQubits.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/dde/RatingQubits.xml b/scripts/dde/RatingQubits.xml index 2d1a48df26a..ca43fe4ce1c 100755 --- a/scripts/dde/RatingQubits.xml +++ b/scripts/dde/RatingQubits.xml @@ -9,4 +9,13 @@ 300 + + 150 + 149 + + + 06/01/2010 06:06:06 + NULL + + From 744d86a5b321fbd3ac0ddef3044fd43deade89ea Mon Sep 17 00:00:00 2001 From: ajefts Date: Sun, 31 Mar 2019 20:45:50 -0400 Subject: [PATCH 19/95] Redirecting to new user settings page --- src/main/com/topcoder/web/tc/view/my_home/index.jsp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/com/topcoder/web/tc/view/my_home/index.jsp b/src/main/com/topcoder/web/tc/view/my_home/index.jsp index 57a5648daec..241d5054929 100755 --- a/src/main/com/topcoder/web/tc/view/my_home/index.jsp +++ b/src/main/com/topcoder/web/tc/view/my_home/index.jsp @@ -41,6 +41,11 @@ +<% + String redirectURL = "https://www.topcoder.com/settings/profile"; + response.sendRedirect(redirectURL); +%> + From a7c341c62a2aee3db50fb81ccfc896cfc132fb77 Mon Sep 17 00:00:00 2001 From: davemess34 Date: Mon, 20 May 2019 10:42:44 -0400 Subject: [PATCH 20/95] added redirect --- .../longcontest/view/activeContests.jsp | 195 +----------------- 1 file changed, 8 insertions(+), 187 deletions(-) diff --git a/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp b/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp index 41c67baa641..5c0bda53596 100644 --- a/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp +++ b/src/main/com/topcoder/web/codinginterface/longcontest/view/activeContests.jsp @@ -1,5 +1,5 @@ -<%@ page contentType="text/html;charset=utf-8" %> - + <%@ page contentType="text/html;charset=utf-8" %> @@ -31,191 +31,12 @@ - - - - - - - - -<%-- Left Column Begins--%> - -<%-- Left Column Ends --%> - -<%-- Center Column Begins --%> - -<%-- Center Column Ends --%> - -<%-- Right Column Begins --%> - -<%-- Right Column Ends --%> - - - -
- - - - - - - - - - -
- Need help? Learn how to get started

-
-
- - <%-- MM Promo On/Off--%> -
- - -
- - - - - - - - - - - - - - - - - - - - <%boolean even = true;%> - - - - - - "> - - - - - - - - - - - <%even = !even;%> - - - - - - - - - - - - - - - - - - - - - - - - -
Active Contests
ContestProblemRegistrantsCompetitorsSubmissionsStart TimeEnd Time
- <% pageContext.setAttribute("sponsorImage", ((LongContest) contest).getSponsorImage());%> -
-
- - - - - - - - - - - -
- ?module=ViewProblemStatement&<%=Constants.COMPONENT_ID%>=&<%=Constants.ROUND_ID%>=" > - - - - - - ?module=ViewReg&<%=Constants.ROUND_ID%>=" - >Register/Submit - - - - - ?module=ViewReg&<%=Constants.ROUND_ID%>=" - >Register - - - ?module=Submit&<%=Constants.COMPONENT_ID%>=&<%=Constants.ROUND_ID%>=&<%=Constants.CONTEST_ID%>=" - >Submit - - - - - - ?module=ViewRegistrants&<%=Constants.ROUND_ID%>=" > - - - - -
-
-
-CMap: DPeak Challenge -
- standings -
-
- CMap: DPeak Challenge - -Register - - - 12.14.2018
11:03 EST
01.04.2019
08:58 EST
-
- There are currently no active contests, but check back soon. -
-
- - - -
- - - -
- - + <% + // New location to be redirected + String site = new String("https://www.topcoder.com/challenges/?filter[tracks][data_science]=true"); + response.setStatus(response.SC_MOVED_PERMANENTLY); + response.setHeader("Location", site); + %> From 3c3b98ae9c121cd7cc980afc1eaa4579b98556cf Mon Sep 17 00:00:00 2001 From: Samir Date: Tue, 25 Jun 2019 15:13:05 +0200 Subject: [PATCH 21/95] load project groups to DW --- .../topcoder/utilities/dwload/TCLoadTCS.java | 91 ++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 2273221c89e..baaa7d9139c 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -364,6 +364,8 @@ public void performLoad() throws Exception { doLoadProjectTechnologies(); + doLoadProjectGroups(); + doLoadSpecReviews(); // load scorecard template before submission review because submission_review will use this table @@ -2143,6 +2145,7 @@ public void doLoadProjects() throws Exception { insert.setDouble(62, rs.getDouble("copilot_cost")); insert.executeUpdate(); + } } else { // we need to delete this project and all related objects in the database. @@ -2171,7 +2174,6 @@ public void doLoadProjects() throws Exception { } } - /** *

* Load Marathon Matches to the DW. @@ -2750,6 +2752,93 @@ public void doLoadProjectTechnologies() throws Exception { } } + /** + * Loads the project groups. + * + * @throws Exception if any error. + * @since 1.2.3 + */ + public void doLoadProjectGroups() throws Exception { + log.info("load project groups"); + + PreparedStatement firstTimeSelect = null; + PreparedStatement deleteGroups = null; + PreparedStatement selectGroups = null; + PreparedStatement insertGroups = null; + ResultSet rs = null; + Set deletedProjects = new HashSet(); + + try { + long start = System.currentTimeMillis(); + + firstTimeSelect = prepareStatement("SELECT count(*) from project_groups", TARGET_DB); + rs = firstTimeSelect.executeQuery(); + rs.next(); + + // no records, it's the first run of loading groups + boolean firstRun = rs.getInt(1) == 0; + + if(firstRun) log.info("Loading project group table for the first time. A complete load will be performed"); + + final String SELECT = "select p.project_id, group_id from project p INNER JOIN common_oltp:contest_eligibility ce ON ce.contest_id = p.project_id INNER JOIN common_oltp:group_contest_eligibility gce ON gce.contest_eligibility_id=ce.contest_eligibility_id \n" + + (firstRun ? "" : " AND (p.create_date > ? OR p.modify_date > ?)") + + "group by p.project_id, group_id"; + + selectGroups = prepareStatement(SELECT, SOURCE_DB); + + if(!firstRun) { + // no the first time, set last loading time + selectGroups.setTimestamp(1, fLastLogTime); + selectGroups.setTimestamp(2, fLastLogTime); + } + + + final String DELETE = "delete from project_groups where project_id = ?"; + deleteGroups = prepareStatement(DELETE, TARGET_DB); + + final String INSERT = "insert into project_groups (project_id, group_id) VALUES (?,?)"; + insertGroups = prepareStatement(INSERT, TARGET_DB); + + rs = selectGroups.executeQuery(); + + int countRecords = 0; + + while (rs.next()) { + long projectID = rs.getLong("project_id"); + long groupId = rs.getLong("group_id"); + + if(!firstRun && !deletedProjects.contains(projectID)) { + // the load is not run for the first time && it's not processed in this load, clear the old technologies for the project + deleteGroups.clearParameters(); + deleteGroups.setLong(1, projectID); + deleteGroups.executeUpdate(); + deletedProjects.add(projectID); + } + + insertGroups.clearParameters(); + insertGroups.setLong(1, projectID); + insertGroups.setLong(2, groupId); + + insertGroups.executeUpdate(); + countRecords ++; + } + + log.info("Loaded " + countRecords + " records in " + (System.currentTimeMillis() - start) / 1000 + " seconds"); + + } catch(SQLException sqle) { + DBMS.printSqlException(true, sqle); + throw new Exception("Load Project groups failed.\n" + + sqle.getMessage()); + } finally { + close(rs); + close(firstTimeSelect); + close(selectGroups); + close(deleteGroups); + close(insertGroups); + deletedProjects.clear(); + } + } + /** * Helper method that deletes all project related objects in the dw. * From 1678f4f763deee5b3de91c1eb9fcf1567ddd4254 Mon Sep 17 00:00:00 2001 From: gondzo Date: Wed, 26 Jun 2019 13:30:17 +0200 Subject: [PATCH 22/95] Update TCLoadTCS.java --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index baaa7d9139c..799326af7e6 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -2719,7 +2719,7 @@ public void doLoadProjectTechnologies() throws Exception { String name = rs.getString("technology_name"); if(!firstRun && !deletedProjects.contains(projectID)) { - // the load is not run for the first time && it's not processed in this load, clear the old technologies for the project + // the load is not run for the first time && it's not processed in this load, clear the old groups for the project deleteTechnologies.clearParameters(); deleteTechnologies.setLong(1, projectID); deleteTechnologies.executeUpdate(); From 5d393c03a5e0c189f6dfa6fc4265c91902fedece Mon Sep 17 00:00:00 2001 From: Samir Date: Mon, 26 Aug 2019 11:36:13 +0200 Subject: [PATCH 23/95] load private projects into DW --- .../topcoder/utilities/dwload/TCLoadTCS.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index baaa7d9139c..4730037f6df 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -262,6 +262,15 @@ public class TCLoadTCS extends TCLoad { " and p.project_id not in (select ce.contest_id from contest_eligibility ce " + " where ce.is_studio = 0) "; + /** + * SQL fragment to be added to a where clause to select projects with eligibility constraints + * + * @since 1.1.5 + */ + private static final String WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT = + " and p.project_id not in (select ce.contest_id from contest_eligibility ce " + + " where ce.is_studio = 0) "; + /** * Confirmed status. * @@ -356,7 +365,9 @@ public void performLoad() throws Exception { doLoadDirectProjectDim(); - doLoadProjects(); + doLoadPublicProjects(); + + doLoadPrivateProjects(); doLoadMarathonMatches(); @@ -1495,6 +1506,14 @@ private void loadNewColumns3ForProjectFirstTime() throws Exception { } } + public void doLoadPublicProjects() throws Exception { + doLoadProjects(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project"); + } + + public void doLoadPrivateProjects() throws Exception { + doLoadProjects(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project"); + } + /** *

* Load projects to the DW. @@ -1502,7 +1521,7 @@ private void loadNewColumns3ForProjectFirstTime() throws Exception { * * @throws Exception if any error occurs */ - public void doLoadProjects() throws Exception { + public void doLoadProjects(String eligibilityConstraint, String targetTable) throws Exception { log.info("load projects"); PreparedStatement select = null; PreparedStatement update = null; @@ -1765,7 +1784,7 @@ public void doLoadProjects() throws Exception { " and piaf.project_info_type_id = 31 " + " and pib.project_id = p.project_id " + " and pib.project_info_type_id = 32 and pib.value > 0 " + - ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT + + eligibilityConstraint + " and cc.component_id = pir.value " + " and cc.root_category_id = cat.category_id " + " and psl.project_status_id = p.project_status_id " + @@ -1798,7 +1817,7 @@ public void doLoadProjects() throws Exception { " WHERE NOT pmd.payment_status_id IN (65, 69) AND (pmd.create_date > ? or pmd.date_modified > ? or pm.create_date > ? or pm.modify_date > ?)) " + (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' OR pir.modify_user <> 'Converter' )" : ")"); - final String UPDATE = "update project set component_name = ?, num_registrations = ?, " + + final String UPDATE = "update " + targetTable + " set component_name = ?, num_registrations = ?, " + "num_submissions = ?, num_valid_submissions = ?, avg_raw_score = ?, avg_final_score = ?, " + "phase_id = ?, phase_desc = ?, category_id = ?, category_desc = ?, posting_date = ?, submitby_date " + "= ?, complete_date = ?, component_id = ?, review_phase_id = ?, review_phase_name = ?, " + @@ -1814,7 +1833,7 @@ public void doLoadProjects() throws Exception { "estimated_reliability_cost = ?, estimated_review_cost = ?, estimated_copilot_cost = ?, estimated_admin_fee = ?, actual_total_prize = ?, copilot_cost = ?" + "where project_id = ? "; - final String INSERT = "insert into project (project_id, component_name, num_registrations, num_submissions, " + + final String INSERT = "insert into " + targetTable + " (project_id, component_name, num_registrations, num_submissions, " + "num_valid_submissions, avg_raw_score, avg_final_score, phase_id, phase_desc, " + "category_id, category_desc, posting_date, submitby_date, complete_date, component_id, " + "review_phase_id, review_phase_name, status_id, status_desc, level_id, viewable_category_ind, version_id, " + @@ -1834,7 +1853,7 @@ public void doLoadProjects() throws Exception { "?, ?, current, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "; // Statements for updating the duration, fulfillment, start_date_calendar_id fields - final String UPDATE_AGAIN = "UPDATE project SET " + + final String UPDATE_AGAIN = "UPDATE " + targetTable + " SET " + "fulfillment = (CASE WHEN status_id = 7 THEN 1 ELSE 0 END), " + "start_date_calendar_id = (SELECT calendar_id FROM calendar c WHERE YEAR(project.posting_date) = c.year " + " AND MONTH(project.posting_date) = c.month_numeric " + @@ -2865,6 +2884,7 @@ private void deleteProject(long projectId) throws SQLException { simpleDelete("project_platform", "project_id", projectId); simpleDelete("project_technology", "project_id", projectId); simpleDelete("project", "project_id", projectId); + simpleDelete("private_project", "project_id", projectId); } /** From 5c84db9e5c6e4be92f29149c1390c1a726c0c8cc Mon Sep 17 00:00:00 2001 From: gondzo Date: Thu, 29 Aug 2019 09:35:45 +0200 Subject: [PATCH 24/95] Update TCLoadTCS.java --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index c863fd9dc02..96d0610bea8 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -268,7 +268,7 @@ public class TCLoadTCS extends TCLoad { * @since 1.1.5 */ private static final String WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT = - " and p.project_id not in (select ce.contest_id from contest_eligibility ce " + + " and p.project_id in (select ce.contest_id from contest_eligibility ce " + " where ce.is_studio = 0) "; /** From 2a4194e91f7daefb70b28eff2ecf28455d2ffe92 Mon Sep 17 00:00:00 2001 From: Samir Date: Mon, 9 Sep 2019 16:11:01 +0200 Subject: [PATCH 25/95] update query --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index c863fd9dc02..27a541e617c 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -1855,9 +1855,9 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable) thr // Statements for updating the duration, fulfillment, start_date_calendar_id fields final String UPDATE_AGAIN = "UPDATE " + targetTable + " SET " + "fulfillment = (CASE WHEN status_id = 7 THEN 1 ELSE 0 END), " + - "start_date_calendar_id = (SELECT calendar_id FROM calendar c WHERE YEAR(project.posting_date) = c.year " + - " AND MONTH(project.posting_date) = c.month_numeric " + - " AND DAY(project.posting_date) = c.day_of_month) " + + "start_date_calendar_id = (SELECT calendar_id FROM calendar c WHERE YEAR("+targetTable+".posting_date) = c.year " + + " AND MONTH("+targetTable+".posting_date) = c.month_numeric " + + " AND DAY("+targetTable+".posting_date) = c.day_of_month) " + "WHERE complete_date IS NOT NULL AND tc_direct_project_id > 0 AND posting_date IS NOT NULL"; select = prepareStatement(SELECT, SOURCE_DB); From d951a00bc7fb6c412efe1e3511eab86b7b25abb0 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Thu, 24 Oct 2019 09:45:21 +0530 Subject: [PATCH 26/95] Added marathon matches to be loaded to DW. Added logs. --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 261f01c12c4..da1a8edff08 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -206,7 +206,7 @@ public class TCLoadTCS extends TCLoad { *

A String representing all those project categories than should be loaded to the * data warehouse.

*/ - private static final String LOAD_CATEGORIES = "(1, 2, 5, 6, 7, 13, 14, 23, 19, 24, 25, 26, 29, 35, 16, 17, 18, 20, 21, 30, 31, 32, 34, 22, 36, 9, 39, 38, 40)"; + private static final String LOAD_CATEGORIES = "(1, 2, 5, 6, 7, 13, 14, 23, 19, 24, 25, 26, 29, 35, 16, 17, 18, 20, 21, 30, 31, 32, 34, 22, 36, 9, 39, 38, 40, 37)"; /** *

An int array representing all project categories that are currently being rated. @@ -1882,6 +1882,7 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable) thr updateAgain = prepareStatement(UPDATE_AGAIN, TARGET_DB); rs = select.executeQuery(); int count = 0; + int insertCount = 0; while (rs.next()) { if (rs.getLong("project_stat_id") != DELETED_PROJECT_STATUS) { @@ -2164,6 +2165,7 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable) thr insert.setDouble(62, rs.getDouble("copilot_cost")); insert.executeUpdate(); + insertCount++; } } else { @@ -2176,6 +2178,7 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable) thr // update the start_date_calendar_id, duration, fulfillment fields updateAgain.executeUpdate(); + log.info("--------------Inserted " + insertCount + " records in " + targetTable + "--------------"); log.info("loaded " + count + " records in " + (System.currentTimeMillis() - start) / 1000 + " seconds"); } catch (SQLException sqle) { From 7058e621d0ceefd8a6362ee70773914b51814a53 Mon Sep 17 00:00:00 2001 From: ajefts Date: Mon, 28 Oct 2019 09:49:37 -0400 Subject: [PATCH 27/95] Updated copyright in footer. --- src/main/com/topcoder/web/jsp/foot.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/topcoder/web/jsp/foot.jsp b/src/main/com/topcoder/web/jsp/foot.jsp index 2c887390a32..1e985a33498 100755 --- a/src/main/com/topcoder/web/jsp/foot.jsp +++ b/src/main/com/topcoder/web/jsp/foot.jsp @@ -124,7 +124,7 @@

- +
From b22d3f0b94643f65825c20408cd7e2a44c32bc36 Mon Sep 17 00:00:00 2001 From: Samir Date: Sun, 5 Apr 2020 00:19:08 +0200 Subject: [PATCH 28/95] add loading of private projects data for project result, design project result and user rating --- .../topcoder/utilities/dwload/TCLoadTCS.java | 58 ++++++++++++++----- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index da1a8edff08..4d8cae90316 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -386,9 +386,13 @@ public void performLoad() throws Exception { doLoadSubmissionReview(); - doLoadProjectResults(); + doLoadPublicProjectResults(); - doLoadDesignProjectResults(); + doLoadPrivateProjectResults(); + + doLoadPublicDesignProjectResults(); + + doLoadPrivateDesignProjectResults(); // doLoadRookies(); @@ -396,7 +400,9 @@ public void performLoad() throws Exception { doLoadContestProject(); - doLoadUserRating(); + doLoadPublicUserRating(); + + doLoadPrivateUserRating(); doLoadUserReliability(); @@ -808,12 +814,20 @@ public void doLoadUserReliability() throws Exception { } } + public void doLoadPublicUserRating() throws Exception { + doLoadUserRating(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "user_rating"); + } + + public void doLoadPrivateUserRating() throws Exception { + doLoadUserRating(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_user_rating"); + } + /** * Loads user ratings * * @throws Exception if any error occurs */ - public void doLoadUserRating() throws Exception { + public void doLoadUserRating(String eligibilityConstraint, String targetTable) throws Exception { log.info("load user rating"); PreparedStatement select = null; PreparedStatement insert = null; @@ -835,21 +849,21 @@ public void doLoadUserRating() throws Exception { " where pr.user_id = ur.user_id " + " and pr.project_id = p.project_id " + " and pr.rating_ind = 1 " + - ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT + + eligibilityConstraint + " and p.project_category_id+111 = ur.phase_id) as highest_rating " + " , (select min(pr.new_rating) " + " from project_result pr, project p " + " where pr.user_id = ur.user_id " + " and pr.project_id = p.project_id " + " and pr.rating_ind = 1 " + - ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT + + eligibilityConstraint + " and p.project_category_id+111 = ur.phase_id) as lowest_rating " + " from user_rating ur " + " where ur.mod_date_time > ?"; - final String UPDATE = "update user_rating set rating = ?, vol = ?, rating_no_vol = ?, num_ratings = ?, last_rated_project_id = ?, mod_date_time = CURRENT, highest_rating = ?, lowest_rating = ? " + + final String UPDATE = "update " + targetTable + " set rating = ?, vol = ?, rating_no_vol = ?, num_ratings = ?, last_rated_project_id = ?, mod_date_time = CURRENT, highest_rating = ?, lowest_rating = ? " + " where user_id = ? and phase_id = ?"; - final String INSERT = "insert into user_rating (user_id, rating, phase_id, vol, rating_no_vol, num_ratings, last_rated_project_id, mod_date_time, create_date_time, highest_rating, lowest_rating) " + + final String INSERT = "insert into " + targetTable + " (user_id, rating, phase_id, vol, rating_no_vol, num_ratings, last_rated_project_id, mod_date_time, create_date_time, highest_rating, lowest_rating) " + "values (?, ?, ?, ?, ?, ?, ?, CURRENT, CURRENT, ?, ?) "; select = prepareStatement(SELECT, SOURCE_DB); @@ -3042,6 +3056,14 @@ private Map getDRProjects() throws Exception { return dRProjects; } + public void doLoadPublicProjectResults() throws Exception { + doLoadProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project_result"); + } + + public void doLoadPrivateProjectResults() throws Exception { + doLoadProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project_result"); + } + /** *

* Load projects results to the DW. @@ -3049,7 +3071,7 @@ private Map getDRProjects() throws Exception { * * @throws Exception if any error occurs */ - public void doLoadProjectResults() throws Exception { + public void doLoadProjectResults(String eligibilityConstraint, String targetTable) throws Exception { log.info("load project results"); ResultSet projectResults = null; PreparedStatement projectSelect = null; @@ -3079,7 +3101,7 @@ public void doLoadProjectResults() throws Exception { "and pi.project_info_type_id = 1 " + "and cv.comp_vers_id= pi.value " + "and cc.component_id = cv.component_id " + - ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT + + eligibilityConstraint + "and (p.modify_date > ? " + " OR cv.modify_date > ? " + " OR pi.modify_date > ? " + @@ -3350,7 +3372,7 @@ public void doLoadProjectResults() throws Exception { // " and pre.user_id = pr.user_id"; final String RESULT_INSERT = - "insert into project_result (project_id, user_id, submit_ind, valid_submission_ind, raw_score, final_score, inquire_timestamp," + + "insert into " + targetTable + " (project_id, user_id, submit_ind, valid_submission_ind, raw_score, final_score, inquire_timestamp," + " submit_timestamp, review_complete_timestamp, payment, old_rating, new_rating, old_reliability, new_reliability, placed, rating_ind, " + " passed_review_ind, points_awarded, final_points, reliable_submission_ind, old_rating_id, " + "new_rating_id, num_ratings, rating_order, potential_points) " + @@ -3721,6 +3743,14 @@ public void doLoadProjectResults() throws Exception { } } + public void doLoadPublicDesignProjectResults() throws Exception { + doLoadDesignProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "design_project_result"); + } + + public void doLoadPrivateDesignProjectResults() throws Exception { + doLoadDesignProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_design_project_result"); + } + /** * Loads design project result * @@ -3728,7 +3758,7 @@ public void doLoadProjectResults() throws Exception { * * @since 1.2.4 */ - public void doLoadDesignProjectResults() throws Exception { + public void doLoadDesignProjectResults(String eligibilityConstraint, String targetTable) throws Exception { log.info("load design project results"); PreparedStatement firstTimeSelect = null; @@ -3766,7 +3796,7 @@ public void doLoadDesignProjectResults() throws Exception { "and pi.project_info_type_id = 1 " + "and cv.comp_vers_id= pi.value " + "and cc.component_id = cv.component_id " + - ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT + + eligibilityConstraint + (!firstRun ? ("and (p.modify_date > ? " + " OR cv.modify_date > ? " + @@ -3822,7 +3852,7 @@ public void doLoadDesignProjectResults() throws Exception { "LEFT OUTER JOIN prize p ON s.prize_id = p.prize_id "; final String RESULT_INSERT = - "INSERT INTO design_project_result (project_id, user_id, submission_id, upload_id, prize_id, prize_amount, placement, dr_points, is_checkpoint, client_selection, submit_timestamp, review_complete_timestamp, inquire_timestamp, submit_ind, valid_submission_ind) " + + "INSERT INTO " + targetTable + " (project_id, user_id, submission_id, upload_id, prize_id, prize_amount, placement, dr_points, is_checkpoint, client_selection, submit_timestamp, review_complete_timestamp, inquire_timestamp, submit_ind, valid_submission_ind) " + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"; From da281e9425e240b0ecbb930679c604267180db87 Mon Sep 17 00:00:00 2001 From: Samir Date: Mon, 6 Apr 2020 09:43:38 +0200 Subject: [PATCH 29/95] handle table deletion and update logging --- .../topcoder/utilities/dwload/TCLoadTCS.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 4d8cae90316..8521716807d 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -916,7 +916,7 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable) t } catch (SQLException sqle) { DBMS.printSqlException(true, sqle); - throw new Exception("Load of 'user_rating' table failed. for user " + userId + " \n" + + throw new Exception("Load of '" + targetTable + "' table failed. for user " + userId + " \n" + sqle.getMessage()); } finally { close(rs); @@ -2891,12 +2891,15 @@ private void deleteProject(long projectId) throws SQLException { simpleDelete("streak", "start_project_id", projectId); simpleDelete("streak", "end_project_id", projectId); simpleDelete("user_rating", "last_rated_project_id", projectId); + simpleDelete("private_user_rating", "last_rated_project_id", projectId); simpleDelete("contest_project_xref", "project_id", projectId); simpleDelete("project_review", "project_id", projectId); simpleDelete("submission", "project_id", projectId); simpleDelete("appeal", "project_id", projectId); simpleDelete("project_result", "project_id", projectId); + simpleDelete("private_project_result", "project_id", projectId); simpleDelete("design_project_result", "project_id", projectId); + simpleDelete("private_design_project_result", "project_id", projectId); simpleDelete("project_spec_review_xref", "project_id", projectId); simpleDelete("project_platform", "project_id", projectId); simpleDelete("project_technology", "project_id", projectId); @@ -3391,7 +3394,7 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl " where project_id = ? " + " and user_id = ?"; final String DW_DATA_UPDATE = - "update project_result set num_appeals = ?, num_successful_appeals = ? where project_id = ? and user_id = ?"; + "update " + targetTable + " set num_appeals = ?, num_successful_appeals = ? where project_id = ? and user_id = ?"; final String NUM_RATINGS = " select count(*) as count " + @@ -3438,7 +3441,7 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl buf.append(" and p.project_id in ("); StringBuffer delQuery = new StringBuffer(300); - delQuery.append("delete from project_result where project_id in ("); + delQuery.append("delete from " + targetTable + " where project_id in ("); StringBuffer delDrPointsQuery = new StringBuffer(300); delDrPointsQuery.append("delete from dr_points where dr_points_reference_type_id = 1 and reference_id in ("); @@ -3730,7 +3733,7 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl } catch (SQLException sqle) { DBMS.printSqlException(true, sqle); - throw new Exception("Load of 'project_result / project' table failed.\n" + + throw new Exception("Load of '" + targetTable + " / project' table failed.\n" + sqle.getMessage()); } finally { close(projectResults); @@ -3882,7 +3885,7 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ StringBuffer delQuery = new StringBuffer(300); - delQuery.append("delete from design_project_result where project_id in ("); + delQuery.append("delete from " + targetTable + " where project_id in ("); boolean projectsFound = false; @@ -3983,7 +3986,7 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ } else { // if not submitted if(projectResults.getObject("upload_id") != null || - designProjectResultExists(projectResults.getLong("project_id"), projectResults.getLong("user_id"), 0l)) + designProjectResultExists(projectResults.getLong("project_id"), projectResults.getLong("user_id"), 0l, targetTable)) continue; resultInsert.setLong(++index, projectResults.getLong("project_id")); @@ -4022,7 +4025,7 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ } catch (SQLException sqle) { DBMS.printSqlException(true, sqle); - throw new Exception("Load of 'design_project_result' table failed.\n" + + throw new Exception("Load of '" + targetTable + "' table failed.\n" + sqle.getMessage()); } finally { close(rs); @@ -4042,13 +4045,13 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ * @param submissionId Id of the submission * @return true if a design project result already exists, false otherwise */ - private boolean designProjectResultExists(Long projectId, Long userId, Long submissionId) throws SQLException { + private boolean designProjectResultExists(Long projectId, Long userId, Long submissionId, String targetTable) throws SQLException { boolean exists = false; PreparedStatement resultQuery = null; ResultSet result = null; try { - resultQuery = prepareStatement("select count(*) ct from design_project_result where project_id = ? and user_id = ? and submission_id = ?", TARGET_DB); + resultQuery = prepareStatement("select count(*) ct from " + targetTable + " where project_id = ? and user_id = ? and submission_id = ?", TARGET_DB); resultQuery.setLong(1, projectId); resultQuery.setLong(2, userId); resultQuery.setLong(3, submissionId); @@ -7915,7 +7918,6 @@ public void doLoadParticipationStats() throws Exception { * @param seasonId the season id * @param startDate the start date * @param endDate the end date - * @param phaseId the phase id * @param contestId the contest id * @param className the class name * @param factor the factor From 5d867d22a42896fdba596f5f6ae66e28e1b03a16 Mon Sep 17 00:00:00 2001 From: Samir Date: Mon, 6 Apr 2020 15:35:33 +0200 Subject: [PATCH 30/95] fix build issue --- src/main/com/topcoder/utilities/dwload/fixes/TCLoadDR.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/com/topcoder/utilities/dwload/fixes/TCLoadDR.java b/src/main/com/topcoder/utilities/dwload/fixes/TCLoadDR.java index 25aad0e45c9..1e9239bf6d3 100644 --- a/src/main/com/topcoder/utilities/dwload/fixes/TCLoadDR.java +++ b/src/main/com/topcoder/utilities/dwload/fixes/TCLoadDR.java @@ -27,7 +27,8 @@ public void performLoad() throws Exception { // Reload project results after 4 may fLastLogTime = new Timestamp(new GregorianCalendar(2007,4,4).getTime().getTime()); - doLoadProjectResults(); + doLoadPublicProjectResults(); + doLoadPrivateProjectResults(); fLastLogTime = new Timestamp(new GregorianCalendar(1980,0,1).getTime().getTime()); doLoadSeason(); From 9a48ca796ff5f579aa471cb884325869952628c3 Mon Sep 17 00:00:00 2001 From: Samir Date: Thu, 9 Apr 2020 00:21:25 +0200 Subject: [PATCH 31/95] add option for full load of private tables --- conf/loadtcs.xml | 3 +- .../topcoder/utilities/dwload/TCLoadTCS.java | 181 ++++++++++-------- 2 files changed, 103 insertions(+), 81 deletions(-) diff --git a/conf/loadtcs.xml b/conf/loadtcs.xml index 329598ce8fe..e8d01438733 100755 --- a/conf/loadtcs.xml +++ b/conf/loadtcs.xml @@ -6,6 +6,7 @@ com.topcoder.utilities.dwload.TCLoadTCS + - + \ No newline at end of file diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 8521716807d..693756e1fe1 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -303,6 +303,8 @@ public TCLoadTCS() { private String submissionDir = null; + private Boolean fullLoad = false; + /** * Return if it will load moved project which not be covered by last old_dw load. * @@ -329,6 +331,11 @@ public boolean setParameters(Hashtable params) { submissionDir = temp; } + String fullLoadStr = (String) params.get("full_load"); + if (fullLoadStr!=null){ + fullLoad = fullLoadStr.equals("true"); + } + return true; } @@ -815,11 +822,11 @@ public void doLoadUserReliability() throws Exception { } public void doLoadPublicUserRating() throws Exception { - doLoadUserRating(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "user_rating"); + doLoadUserRating(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "user_rating", false); } public void doLoadPrivateUserRating() throws Exception { - doLoadUserRating(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_user_rating"); + doLoadUserRating(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_user_rating", fullLoad); } /** @@ -827,7 +834,7 @@ public void doLoadPrivateUserRating() throws Exception { * * @throws Exception if any error occurs */ - public void doLoadUserRating(String eligibilityConstraint, String targetTable) throws Exception { + public void doLoadUserRating(String eligibilityConstraint, String targetTable, boolean fullLoad) throws Exception { log.info("load user rating"); PreparedStatement select = null; PreparedStatement insert = null; @@ -859,7 +866,7 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable) t eligibilityConstraint + " and p.project_category_id+111 = ur.phase_id) as lowest_rating " + " from user_rating ur " + - " where ur.mod_date_time > ?"; + (!fullLoad ? " where ur.mod_date_time > ?":""); final String UPDATE = "update " + targetTable + " set rating = ?, vol = ?, rating_no_vol = ?, num_ratings = ?, last_rated_project_id = ?, mod_date_time = CURRENT, highest_rating = ?, lowest_rating = ? " + " where user_id = ? and phase_id = ?"; @@ -867,7 +874,9 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable) t "values (?, ?, ?, ?, ?, ?, ?, CURRENT, CURRENT, ?, ?) "; select = prepareStatement(SELECT, SOURCE_DB); - select.setTimestamp(1, fLastLogTime); + if (!fullLoad) { + select.setTimestamp(1, fLastLogTime); + } insert = prepareStatement(INSERT, TARGET_DB); update = prepareStatement(UPDATE, TARGET_DB); @@ -997,7 +1006,7 @@ private void setTimestampParameter(ResultSet rs, PreparedStatement statement, St * @throws Exception if any error. * @since 1.3 */ - private void loadNewColumnsForProjectFirstTime() throws Exception { + private void loadNewColumnsForProjectFirstTime(String targetTable) throws Exception { PreparedStatement countChallengeCreatorPS = null; PreparedStatement selectExistingProjectToUpdatePS = null; PreparedStatement selectNewColumnsDataPS = null; @@ -1016,7 +1025,7 @@ private void loadNewColumnsForProjectFirstTime() throws Exception { query = new StringBuffer(100); // check if there're existing any records in tcs_dw:project which have challenge_creator populated - query.append("SELECT count(*) from project WHERE challenge_creator IS NOT NULL"); + query.append("SELECT count(*) from " + targetTable + " WHERE challenge_creator IS NOT NULL"); countChallengeCreatorPS = prepareStatement(query.toString(), TARGET_DB); rs = countChallengeCreatorPS.executeQuery(); @@ -1030,7 +1039,7 @@ private void loadNewColumnsForProjectFirstTime() throws Exception { // load project_id for the existing project records in tcs_dw query.delete(0, query.length()); - query.append("SELECT project_id FROM project"); + query.append("SELECT project_id FROM "+targetTable); selectExistingProjectToUpdatePS = prepareStatement(query.toString(), TARGET_DB); rs = selectExistingProjectToUpdatePS.executeQuery(); @@ -1099,7 +1108,7 @@ private void loadNewColumnsForProjectFirstTime() throws Exception { // query to update the existing payment records in topcoder_dw query.delete(0, query.length()); - query.append("UPDATE project SET challenge_manager = ?, challenge_creator = ?, challenge_launcher = ?, copilot = ?, checkpoint_start_date = ?, checkpoint_end_date = ? WHERE project_id = ?"); + query.append("UPDATE " + targetTable + " SET challenge_manager = ?, challenge_creator = ?, challenge_launcher = ?, copilot = ?, checkpoint_start_date = ?, checkpoint_end_date = ? WHERE project_id = ?"); updateProjectPS = prepareStatement(query.toString(), TARGET_DB); while (rs.next()) { @@ -1168,7 +1177,7 @@ private void loadNewColumnsForProjectFirstTime() throws Exception { * @throws Exception if any error. * @since 1.4 */ - private void loadNewColumns2ForProjectFirstTime() throws Exception { + private void loadNewColumns2ForProjectFirstTime(String targetTable) throws Exception { PreparedStatement countChallengeCreatorPS = null; PreparedStatement selectExistingProjectToUpdatePS = null; PreparedStatement selectNewColumnsDataPS = null; @@ -1187,7 +1196,7 @@ private void loadNewColumns2ForProjectFirstTime() throws Exception { query = new StringBuffer(100); // check if there're existing any records in tcs_dw:project which have review_cost populated - query.append("SELECT count(*) from project WHERE review_cost IS NOT NULL"); + query.append("SELECT count(*) from " + targetTable + " WHERE review_cost IS NOT NULL"); countChallengeCreatorPS = prepareStatement(query.toString(), TARGET_DB); rs = countChallengeCreatorPS.executeQuery(); @@ -1204,7 +1213,7 @@ private void loadNewColumns2ForProjectFirstTime() throws Exception { // load project_id for the existing project records in tcs_dw query.delete(0, query.length()); - query.append("SELECT project_id FROM project"); + query.append("SELECT project_id FROM " + targetTable); selectExistingProjectToUpdatePS = prepareStatement(query.toString(), TARGET_DB); rs = selectExistingProjectToUpdatePS.executeQuery(); @@ -1250,7 +1259,7 @@ private void loadNewColumns2ForProjectFirstTime() throws Exception { // query to update the existing payment records in topcoder_dw query.delete(0, query.length()); - query.append("UPDATE project SET registration_end_date = ?, scheduled_end_date = ?, checkpoint_prize_amount = ?, checkpoint_prize_number = ?, dr_points = ?, " + + query.append("UPDATE " + targetTable + " SET registration_end_date = ?, scheduled_end_date = ?, checkpoint_prize_amount = ?, checkpoint_prize_number = ?, dr_points = ?, " + "reliability_cost = ?, review_cost = ?, forum_id = ?, submission_viewable = ?, is_private = ? WHERE project_id = ?"); updateProjectPS = prepareStatement(query.toString(), TARGET_DB); @@ -1311,7 +1320,7 @@ private void loadNewColumns2ForProjectFirstTime() throws Exception { * @throws Exception if any error. * @since 1.4.2 */ - private void loadNewColumns3ForProjectFirstTime() throws Exception { + private void loadNewColumns3ForProjectFirstTime(String targetTable) throws Exception { PreparedStatement countEstimatedReviewCostPS = null; PreparedStatement selectExistingProjectToUpdatePS = null; PreparedStatement selectNewColumnsDataPS = null; @@ -1330,7 +1339,7 @@ private void loadNewColumns3ForProjectFirstTime() throws Exception { query = new StringBuffer(100); // check if there're existing any records in tcs_dw:project which have estimated_review_cost populated - query.append("SELECT count(*) from project WHERE estimated_review_cost IS NOT NULL"); + query.append("SELECT count(*) from " + targetTable +" WHERE estimated_review_cost IS NOT NULL"); countEstimatedReviewCostPS = prepareStatement(query.toString(), TARGET_DB); rs = countEstimatedReviewCostPS.executeQuery(); @@ -1471,7 +1480,7 @@ private void loadNewColumns3ForProjectFirstTime() throws Exception { // query to update the existing payment records in topcoder_dw query.delete(0, query.length()); - query.append("UPDATE project SET estimated_reliability_cost = ?, estimated_review_cost = ?, estimated_copilot_cost = ?, estimated_admin_fee = ?, actual_total_prize = ?, " + + query.append("UPDATE " + targetTable + " SET estimated_reliability_cost = ?, estimated_review_cost = ?, estimated_copilot_cost = ?, estimated_admin_fee = ?, actual_total_prize = ?, " + "copilot_cost = ? WHERE project_id = ?"); updateProjectPS = prepareStatement(query.toString(), TARGET_DB); @@ -1521,11 +1530,11 @@ private void loadNewColumns3ForProjectFirstTime() throws Exception { } public void doLoadPublicProjects() throws Exception { - doLoadProjects(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project"); + doLoadProjects(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project", false); } public void doLoadPrivateProjects() throws Exception { - doLoadProjects(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project"); + doLoadProjects(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project", fullLoad); } /** @@ -1535,7 +1544,7 @@ public void doLoadPrivateProjects() throws Exception { * * @throws Exception if any error occurs */ - public void doLoadProjects(String eligibilityConstraint, String targetTable) throws Exception { + public void doLoadProjects(String eligibilityConstraint, String targetTable, boolean fullLoad) throws Exception { log.info("load projects"); PreparedStatement select = null; PreparedStatement update = null; @@ -1547,14 +1556,14 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable) thr //log.debug("PROCESSING PROJECT " + project_id); long start = System.currentTimeMillis(); - loadNewColumnsForProjectFirstTime(); + loadNewColumnsForProjectFirstTime(targetTable); - loadNewColumns2ForProjectFirstTime(); + loadNewColumns2ForProjectFirstTime(targetTable); - loadNewColumns3ForProjectFirstTime(); + loadNewColumns3ForProjectFirstTime(targetTable); //get data from source DB - final String SELECT = + String SELECT = "select p.project_id " + " ,cc.component_id " + " ,cc.component_name " + @@ -1814,22 +1823,26 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable) thr // we need to process deleted project, otherwise there's a possibility // they will keep living in the DW. //" and p.project_status_id <> 3 " + - " and p.project_category_id in " + LOAD_CATEGORIES + - " and (p.modify_date > ? " + - // comp versions with modified date - " or cv.modify_date > ? " + - // add projects who have modified resources - " or p.project_id in (select distinct r.project_id from resource r where (r.create_date > ? or r.modify_date > ?)) " + - // add projects who have modified upload and submissions - " or p.project_id in (select distinct u.project_id from upload u, submission s where s.submission_type_id = 1 and u.upload_id = s.upload_id and " + - " (u.create_date > ? or u.modify_date > ? or s.create_date > ? or s.modify_date > ?)) " + - // add projects who have modified results - " or p.project_id in (select distinct pr.project_id from project_result pr where (pr.create_date > ? or pr.modify_date > ?)) " + - " or p.project_id in (select distinct pi.project_id from project_info pi where project_info_type_id in (2, 3, 21, 22, 23, 26, 31, 32, 33, 38, 45, 49) and (pi.create_date > ? or pi.modify_date > ?)) " + - " or p.project_id in (select distinct pmd.component_project_id::int " + - " FROM informixoltp:payment pm INNER JOIN informixoltp:payment_detail pmd ON pm.most_recent_detail_id = pmd.payment_detail_id " + - " WHERE NOT pmd.payment_status_id IN (65, 69) AND (pmd.create_date > ? or pmd.date_modified > ? or pm.create_date > ? or pm.modify_date > ?)) " + - (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' OR pir.modify_user <> 'Converter' )" : ")"); + " and p.project_category_id in " + LOAD_CATEGORIES; + + if (!fullLoad){ + SELECT += " and (p.modify_date > ? " + + // comp versions with modified date + " or cv.modify_date > ? " + + // add projects who have modified resources + " or p.project_id in (select distinct r.project_id from resource r where (r.create_date > ? or r.modify_date > ?)) " + + // add projects who have modified upload and submissions + " or p.project_id in (select distinct u.project_id from upload u, submission s where s.submission_type_id = 1 and u.upload_id = s.upload_id and " + + " (u.create_date > ? or u.modify_date > ? or s.create_date > ? or s.modify_date > ?)) " + + // add projects who have modified results + " or p.project_id in (select distinct pr.project_id from project_result pr where (pr.create_date > ? or pr.modify_date > ?)) " + + " or p.project_id in (select distinct pi.project_id from project_info pi where project_info_type_id in (2, 3, 21, 22, 23, 26, 31, 32, 33, 38, 45, 49) and (pi.create_date > ? or pi.modify_date > ?)) " + + " or p.project_id in (select distinct pmd.component_project_id::int " + + " FROM informixoltp:payment pm INNER JOIN informixoltp:payment_detail pmd ON pm.most_recent_detail_id = pmd.payment_detail_id " + + " WHERE NOT pmd.payment_status_id IN (65, 69) AND (pmd.create_date > ? or pmd.date_modified > ? or pm.create_date > ? or pm.modify_date > ?)) " + + (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' OR pir.modify_user <> 'Converter' )" : ")"); + } + final String UPDATE = "update " + targetTable + " set component_name = ?, num_registrations = ?, " + "num_submissions = ?, num_valid_submissions = ?, avg_raw_score = ?, avg_final_score = ?, " + @@ -1875,22 +1888,24 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable) thr "WHERE complete_date IS NOT NULL AND tc_direct_project_id > 0 AND posting_date IS NOT NULL"; select = prepareStatement(SELECT, SOURCE_DB); - select.setTimestamp(1, fLastLogTime); - select.setTimestamp(2, fLastLogTime); - select.setTimestamp(3, fLastLogTime); - select.setTimestamp(4, fLastLogTime); - select.setTimestamp(5, fLastLogTime); - select.setTimestamp(6, fLastLogTime); - select.setTimestamp(7, fLastLogTime); - select.setTimestamp(8, fLastLogTime); - select.setTimestamp(9, fLastLogTime); - select.setTimestamp(10, fLastLogTime); - select.setTimestamp(11, fLastLogTime); - select.setTimestamp(12, fLastLogTime); - select.setTimestamp(13, fLastLogTime); - select.setTimestamp(14, fLastLogTime); - select.setTimestamp(15, fLastLogTime); - select.setTimestamp(16, fLastLogTime); + if (!fullLoad) { + select.setTimestamp(1, fLastLogTime); + select.setTimestamp(2, fLastLogTime); + select.setTimestamp(3, fLastLogTime); + select.setTimestamp(4, fLastLogTime); + select.setTimestamp(5, fLastLogTime); + select.setTimestamp(6, fLastLogTime); + select.setTimestamp(7, fLastLogTime); + select.setTimestamp(8, fLastLogTime); + select.setTimestamp(9, fLastLogTime); + select.setTimestamp(10, fLastLogTime); + select.setTimestamp(11, fLastLogTime); + select.setTimestamp(12, fLastLogTime); + select.setTimestamp(13, fLastLogTime); + select.setTimestamp(14, fLastLogTime); + select.setTimestamp(15, fLastLogTime); + select.setTimestamp(16, fLastLogTime); + } update = prepareStatement(UPDATE, TARGET_DB); insert = prepareStatement(INSERT, TARGET_DB); updateAgain = prepareStatement(UPDATE_AGAIN, TARGET_DB); @@ -3060,11 +3075,11 @@ private Map getDRProjects() throws Exception { } public void doLoadPublicProjectResults() throws Exception { - doLoadProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project_result"); + doLoadProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project_result", false); } public void doLoadPrivateProjectResults() throws Exception { - doLoadProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project_result"); + doLoadProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project_result", fullLoad); } /** @@ -3074,7 +3089,7 @@ public void doLoadPrivateProjectResults() throws Exception { * * @throws Exception if any error occurs */ - public void doLoadProjectResults(String eligibilityConstraint, String targetTable) throws Exception { + public void doLoadProjectResults(String eligibilityConstraint, String targetTable, boolean fullLoad) throws Exception { log.info("load project results"); ResultSet projectResults = null; PreparedStatement projectSelect = null; @@ -3090,7 +3105,7 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl ResultSet projects = null; ResultSet dwData = null; - final String PROJECTS_SELECT = + String PROJECTS_SELECT = "select distinct pr.project_id " + "from project_result pr, " + "project p, " + @@ -3104,16 +3119,20 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl "and pi.project_info_type_id = 1 " + "and cv.comp_vers_id= pi.value " + "and cc.component_id = cv.component_id " + - eligibilityConstraint + - "and (p.modify_date > ? " + - " OR cv.modify_date > ? " + - " OR pi.modify_date > ? " + - " OR cc.modify_date > ? " + - " OR pr.modify_date > ?" + - (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' " + - " OR pi.modify_user <> 'Converter' " + - ")" - : ")"); + eligibilityConstraint; + if (fullLoad){ + PROJECTS_SELECT+= + "and (p.modify_date > ? " + + " OR cv.modify_date > ? " + + " OR pi.modify_date > ? " + + " OR cc.modify_date > ? " + + " OR pr.modify_date > ?" + + (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' " + + " OR pi.modify_user <> 'Converter' " + + ")" + : ")"); + } + final String RESULT_SELECT = "SELECT DISTINCT pr.project_id, " + " pr.user_id, " + @@ -3416,11 +3435,13 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl Map dRProjects = getDRProjects(); projectSelect = prepareStatement(PROJECTS_SELECT, SOURCE_DB); - projectSelect.setTimestamp(1, fLastLogTime); - projectSelect.setTimestamp(2, fLastLogTime); - projectSelect.setTimestamp(3, fLastLogTime); - projectSelect.setTimestamp(4, fLastLogTime); - projectSelect.setTimestamp(5, fLastLogTime); + if (!fullLoad) { + projectSelect.setTimestamp(1, fLastLogTime); + projectSelect.setTimestamp(2, fLastLogTime); + projectSelect.setTimestamp(3, fLastLogTime); + projectSelect.setTimestamp(4, fLastLogTime); + projectSelect.setTimestamp(5, fLastLogTime); + } resultInsert = prepareStatement(RESULT_INSERT, TARGET_DB); drInsert = prepareStatement(DR_POINTS_INSERT, SOURCE_DB); @@ -3747,11 +3768,11 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl } public void doLoadPublicDesignProjectResults() throws Exception { - doLoadDesignProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "design_project_result"); + doLoadDesignProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "design_project_result", false); } public void doLoadPrivateDesignProjectResults() throws Exception { - doLoadDesignProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_design_project_result"); + doLoadDesignProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_design_project_result", fullLoad); } /** @@ -3761,7 +3782,7 @@ public void doLoadPrivateDesignProjectResults() throws Exception { * * @since 1.2.4 */ - public void doLoadDesignProjectResults(String eligibilityConstraint, String targetTable) throws Exception { + public void doLoadDesignProjectResults(String eligibilityConstraint, String targetTable, boolean fullLoad) throws Exception { log.info("load design project results"); PreparedStatement firstTimeSelect = null; @@ -3777,7 +3798,7 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ try { - firstTimeSelect = prepareStatement("SELECT count(*) from design_project_result", TARGET_DB); + firstTimeSelect = prepareStatement("SELECT count(*) from "+targetTable, TARGET_DB); rs = firstTimeSelect.executeQuery(); rs.next(); @@ -3800,7 +3821,7 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ "and cv.comp_vers_id= pi.value " + "and cc.component_id = cv.component_id " + eligibilityConstraint + - (!firstRun ? + (!firstRun && !fullLoad ? ("and (p.modify_date > ? " + " OR cv.modify_date > ? " + " OR pi.modify_date > ? " + @@ -3864,7 +3885,7 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ resultInsert = prepareStatement(RESULT_INSERT, TARGET_DB); - if (!firstRun) { + if (!firstRun && !fullLoad) { projectSelect.setTimestamp(1, fLastLogTime); projectSelect.setTimestamp(2, fLastLogTime); projectSelect.setTimestamp(3, fLastLogTime); From 9dbe8fca258b8a0e2a9c59426a262c4d7e031cdb Mon Sep 17 00:00:00 2001 From: Samir Date: Thu, 9 Apr 2020 11:38:56 +0200 Subject: [PATCH 32/95] add batch data loading for private tables --- .../topcoder/utilities/dwload/TCLoadTCS.java | 181 +++++++++++------- 1 file changed, 111 insertions(+), 70 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 693756e1fe1..610bccba9a0 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -21,17 +21,9 @@ import java.sql.Timestamp; import java.sql.Types; import java.text.DateFormat; +import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; +import java.util.*; /** *

Purpose: @@ -305,6 +297,8 @@ public TCLoadTCS() { private Boolean fullLoad = false; + private List dateFilterBatches = null; + /** * Return if it will load moved project which not be covered by last old_dw load. * @@ -334,6 +328,21 @@ public boolean setParameters(Hashtable params) { String fullLoadStr = (String) params.get("full_load"); if (fullLoadStr!=null){ fullLoad = fullLoadStr.equals("true"); + dateFilterBatches = new ArrayList<>(); + try { + java.util.Date startDate = DATE_FORMATS[0].parse("01/01/2000 00:00"); + java.util.Date now = new java.util.Date(); + Calendar cal = Calendar.getInstance(); + while (startDate.getTime() ?":""); + " from user_rating ur "; + if (endTime==null){ + SELECT +=" where ur.mod_date_time > ?"; + } else { + SELECT +=" where ur.mod_date_time >= ? and ur.mod_date_time < ?"; + } final String UPDATE = "update " + targetTable + " set rating = ?, vol = ?, rating_no_vol = ?, num_ratings = ?, last_rated_project_id = ?, mod_date_time = CURRENT, highest_rating = ?, lowest_rating = ? " + " where user_id = ? and phase_id = ?"; @@ -874,8 +889,11 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable, b "values (?, ?, ?, ?, ?, ?, ?, CURRENT, CURRENT, ?, ?) "; select = prepareStatement(SELECT, SOURCE_DB); - if (!fullLoad) { - select.setTimestamp(1, fLastLogTime); + if (endTime==null) { + select.setTimestamp(1, startTime); + } else { + select.setTimestamp(1, startTime); + select.setTimestamp(1, endTime); } insert = prepareStatement(INSERT, TARGET_DB); @@ -1530,11 +1548,13 @@ private void loadNewColumns3ForProjectFirstTime(String targetTable) throws Excep } public void doLoadPublicProjects() throws Exception { - doLoadProjects(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project", false); + doLoadProjects(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project", fLastLogTime, null); } public void doLoadPrivateProjects() throws Exception { - doLoadProjects(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project", fullLoad); + for (int i=0;i 3 " + " and p.project_category_id in " + LOAD_CATEGORIES; - if (!fullLoad){ + if (endTime==null){ SELECT += " and (p.modify_date > ? " + // comp versions with modified date " or cv.modify_date > ? " + @@ -1841,6 +1861,8 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable, boo " FROM informixoltp:payment pm INNER JOIN informixoltp:payment_detail pmd ON pm.most_recent_detail_id = pmd.payment_detail_id " + " WHERE NOT pmd.payment_status_id IN (65, 69) AND (pmd.create_date > ? or pmd.date_modified > ? or pm.create_date > ? or pm.modify_date > ?)) " + (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' OR pir.modify_user <> 'Converter' )" : ")"); + } else { + SELECT += " and (p.create_date >= ? and p.create_date < ?)"; } @@ -1888,23 +1910,26 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable, boo "WHERE complete_date IS NOT NULL AND tc_direct_project_id > 0 AND posting_date IS NOT NULL"; select = prepareStatement(SELECT, SOURCE_DB); - if (!fullLoad) { - select.setTimestamp(1, fLastLogTime); - select.setTimestamp(2, fLastLogTime); - select.setTimestamp(3, fLastLogTime); - select.setTimestamp(4, fLastLogTime); - select.setTimestamp(5, fLastLogTime); - select.setTimestamp(6, fLastLogTime); - select.setTimestamp(7, fLastLogTime); - select.setTimestamp(8, fLastLogTime); - select.setTimestamp(9, fLastLogTime); - select.setTimestamp(10, fLastLogTime); - select.setTimestamp(11, fLastLogTime); - select.setTimestamp(12, fLastLogTime); - select.setTimestamp(13, fLastLogTime); - select.setTimestamp(14, fLastLogTime); - select.setTimestamp(15, fLastLogTime); - select.setTimestamp(16, fLastLogTime); + if (endTime==null) { + select.setTimestamp(1, startTime); + select.setTimestamp(2, startTime); + select.setTimestamp(3, startTime); + select.setTimestamp(4, startTime); + select.setTimestamp(5, startTime); + select.setTimestamp(6, startTime); + select.setTimestamp(7, startTime); + select.setTimestamp(8, startTime); + select.setTimestamp(9, startTime); + select.setTimestamp(10, startTime); + select.setTimestamp(11, startTime); + select.setTimestamp(12, startTime); + select.setTimestamp(13, startTime); + select.setTimestamp(14, startTime); + select.setTimestamp(15, startTime); + select.setTimestamp(16, startTime); + } else { + select.setTimestamp(1, startTime); + select.setTimestamp(2, endTime); } update = prepareStatement(UPDATE, TARGET_DB); insert = prepareStatement(INSERT, TARGET_DB); @@ -3075,11 +3100,13 @@ private Map getDRProjects() throws Exception { } public void doLoadPublicProjectResults() throws Exception { - doLoadProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project_result", false); + doLoadProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "project_result", fLastLogTime, null); } public void doLoadPrivateProjectResults() throws Exception { - doLoadProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project_result", fullLoad); + for (int i=0;i 3 " + "and p.project_category_id in " + LOAD_CATEGORIES + "and pi.project_info_type_id = 1 " + - "and cv.comp_vers_id= pi.value " + - "and cc.component_id = cv.component_id " + eligibilityConstraint; - if (fullLoad){ + if (endTime==null){ PROJECTS_SELECT+= + "and cv.comp_vers_id= pi.value " + + "and cc.component_id = cv.component_id " + "and (p.modify_date > ? " + " OR cv.modify_date > ? " + " OR pi.modify_date > ? " + @@ -3131,6 +3158,9 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl " OR pi.modify_user <> 'Converter' " + ")" : ")"); + } else { + PROJECTS_SELECT+= + "and (p.create_date >= ? and p.create_date < ?)"; } @@ -3435,12 +3465,15 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl Map dRProjects = getDRProjects(); projectSelect = prepareStatement(PROJECTS_SELECT, SOURCE_DB); - if (!fullLoad) { - projectSelect.setTimestamp(1, fLastLogTime); - projectSelect.setTimestamp(2, fLastLogTime); - projectSelect.setTimestamp(3, fLastLogTime); - projectSelect.setTimestamp(4, fLastLogTime); - projectSelect.setTimestamp(5, fLastLogTime); + if (endTime == null) { + projectSelect.setTimestamp(1, startTime); + projectSelect.setTimestamp(2, startTime); + projectSelect.setTimestamp(3, startTime); + projectSelect.setTimestamp(4, startTime); + projectSelect.setTimestamp(5, startTime); + } else { + projectSelect.setTimestamp(1, startTime); + projectSelect.setTimestamp(2, endTime); } resultInsert = prepareStatement(RESULT_INSERT, TARGET_DB); @@ -3768,11 +3801,13 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl } public void doLoadPublicDesignProjectResults() throws Exception { - doLoadDesignProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "design_project_result", false); + doLoadDesignProjectResults(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "design_project_result", fLastLogTime, null); } public void doLoadPrivateDesignProjectResults() throws Exception { - doLoadDesignProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_design_project_result", fullLoad); + for (int i=0;i ? " + - " OR cv.modify_date > ? " + - " OR pi.modify_date > ? " + - " OR cc.modify_date > ? " + - (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' " + - " OR pi.modify_user <> 'Converter' " + - ")" - : ")")) : ""); + eligibilityConstraint; + if (!firstRun && endTime==null) { + PROJECTS_SELECT += "and (p.modify_date > ? " + + " OR cv.modify_date > ? " + + " OR pi.modify_date > ? " + + " OR cc.modify_date > ? " + + (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' " + + " OR pi.modify_user <> 'Converter' " + + ")" + : ")"); + } else { + PROJECTS_SELECT += "and (p.create_date >= ? and p.create_date < ?)"; + } final String RESULT_SELECT = "SELECT pj.project_id , " + " s.submission_id , " + @@ -3885,11 +3923,14 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ resultInsert = prepareStatement(RESULT_INSERT, TARGET_DB); - if (!firstRun && !fullLoad) { - projectSelect.setTimestamp(1, fLastLogTime); - projectSelect.setTimestamp(2, fLastLogTime); - projectSelect.setTimestamp(3, fLastLogTime); - projectSelect.setTimestamp(4, fLastLogTime); + if (!firstRun && endTime == null) { + projectSelect.setTimestamp(1, startTime); + projectSelect.setTimestamp(2, startTime); + projectSelect.setTimestamp(3, startTime); + projectSelect.setTimestamp(4, startTime); + } else { + projectSelect.setTimestamp(1, startTime); + projectSelect.setTimestamp(2, endTime); } projects = projectSelect.executeQuery(); From 082d0a1507898aa4c6898531a3732b698978b137 Mon Sep 17 00:00:00 2001 From: Samir Date: Sat, 11 Apr 2020 01:41:26 +0200 Subject: [PATCH 33/95] add batch size parameter --- conf/loadtcs.xml | 1 + .../topcoder/utilities/dwload/TCLoadTCS.java | 35 ++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/conf/loadtcs.xml b/conf/loadtcs.xml index e8d01438733..85d3954fc16 100755 --- a/conf/loadtcs.xml +++ b/conf/loadtcs.xml @@ -7,6 +7,7 @@ + \ No newline at end of file diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 610bccba9a0..0cdd1bf92a2 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -330,13 +330,14 @@ public boolean setParameters(Hashtable params) { fullLoad = fullLoadStr.equals("true"); dateFilterBatches = new ArrayList<>(); try { + int batchDays = Integer.parseInt((String) params.get("batch_size_days")); java.util.Date startDate = DATE_FORMATS[0].parse("01/01/2000 00:00"); java.util.Date now = new java.util.Date(); Calendar cal = Calendar.getInstance(); while (startDate.getTime() Date: Sat, 11 Apr 2020 18:53:05 +0530 Subject: [PATCH 34/95] Correct query for full load. --- .../topcoder/utilities/dwload/TCLoadTCS.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 0cdd1bf92a2..f9972fa7a31 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -3146,20 +3146,25 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl ResultSet dwData = null; String PROJECTS_SELECT = - "select distinct pr.project_id " + - "from project_result pr, " + - "project p, " + + "select distinct p.project_id " + + "from project p "; + + if(endTime == null) { + PROJECTS_SELECT+= + ", project_result pr, " + "project_info pi, " + "comp_versions cv, " + - "comp_catalog cc " + - "where p.project_id = pr.project_id " + - "and p.project_id = pi.project_id " + - "and p.project_status_id <> 3 " + - "and p.project_category_id in " + LOAD_CATEGORIES + - "and pi.project_info_type_id = 1 " + - eligibilityConstraint; + "comp_catalog cc "; + + } + PROJECTS_SELECT+= "where p.project_status_id <> 3" + + "and p.project_category_id in " + LOAD_CATEGORIES + + eligibilityConstraint; if (endTime==null){ PROJECTS_SELECT+= + "and p.project_id = pi.project_id " + + "and p.project_id = pr.project_id" + + "and pi.project_info_type_id = 1 " + "and cv.comp_vers_id= pi.value " + "and cc.component_id = cv.component_id " + "and (p.modify_date > ? " + From 6585648fe98c9bf80d2435e36ea1bffb7cae14dc Mon Sep 17 00:00:00 2001 From: Samir Date: Mon, 13 Apr 2020 22:55:10 +0200 Subject: [PATCH 35/95] use user rating create date for select query --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index f9972fa7a31..e6cdd4bef72 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -883,9 +883,9 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable, T " and p.project_category_id+111 = ur.phase_id) as lowest_rating " + " from user_rating ur "; if (endTime==null){ - SELECT +=" where ur.mod_date_time > ?"; + SELECT +=" where ur.create_date_time > ?"; } else { - SELECT +=" where ur.mod_date_time >= ? and ur.mod_date_time < ?"; + SELECT +=" where ur.create_date_time >= ? and ur.create_date_time < ?"; } final String UPDATE = "update " + targetTable + " set rating = ?, vol = ?, rating_no_vol = ?, num_ratings = ?, last_rated_project_id = ?, mod_date_time = CURRENT, highest_rating = ?, lowest_rating = ? " + @@ -898,7 +898,7 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable, T select.setTimestamp(1, startTime); } else { select.setTimestamp(1, startTime); - select.setTimestamp(1, endTime); + select.setTimestamp(2, endTime); } insert = prepareStatement(INSERT, TARGET_DB); From 9e4e3cc5a2340bb52a1e044e227435438988c0e4 Mon Sep 17 00:00:00 2001 From: Samir Date: Tue, 14 Apr 2020 10:34:26 +0200 Subject: [PATCH 36/95] update project selection query for private project design results --- .../topcoder/utilities/dwload/TCLoadTCS.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index e6cdd4bef72..6f0596356a1 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -3865,28 +3865,33 @@ public void doLoadDesignProjectResults(String eligibilityConstraint, String targ String PROJECTS_SELECT = "select distinct p.project_id " + "from project p, " + - "project_info pi, " + + "project_info pi, "; + if (!firstRun && endTime==null) { + PROJECTS_SELECT += "comp_versions cv, " + - "comp_catalog cc, " + + "comp_catalog cc, "; + } + PROJECTS_SELECT += "project_category_lu pcl " + "where " + " p.project_id = pi.project_id " + " and p.project_category_id = pcl.project_category_id " + " and pcl.project_type_id = 3 " + "and p.project_status_id NOT IN (1, 2, 3, 9, 10, 11)" + - "and pi.project_info_type_id = 1 " + - "and cv.comp_vers_id= pi.value " + - "and cc.component_id = cv.component_id " + + "and pi.project_info_type_id = 1 "+ eligibilityConstraint; if (!firstRun && endTime==null) { - PROJECTS_SELECT += "and (p.modify_date > ? " + - " OR cv.modify_date > ? " + - " OR pi.modify_date > ? " + - " OR cc.modify_date > ? " + - (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' " + - " OR pi.modify_user <> 'Converter' " + - ")" - : ")"); + PROJECTS_SELECT += + "and cv.comp_vers_id= pi.value " + + "and cc.component_id = cv.component_id " + + "and (p.modify_date > ? " + + " OR cv.modify_date > ? " + + " OR pi.modify_date > ? " + + " OR cc.modify_date > ? " + + (needLoadMovedProject() ? " OR p.modify_user <> 'Converter' " + + " OR pi.modify_user <> 'Converter' " + + ")" + : ")"); } else { PROJECTS_SELECT += "and (p.create_date >= ? and p.create_date < ?)"; } From 1035cad65e3145991e906aa5ecde778da6b144e9 Mon Sep 17 00:00:00 2001 From: Samir Date: Wed, 15 Apr 2020 14:10:24 +0200 Subject: [PATCH 37/95] update loading --- .../topcoder/utilities/dwload/TCLoadTCS.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 6f0596356a1..3a490367d5a 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -838,6 +838,7 @@ public void doLoadPublicUserRating() throws Exception { public void doLoadPrivateUserRating() throws Exception { if (fullLoad) { for (int i = 0; i < dateFilterBatches.size() - 1; i++) { + log.info("loading projects from "+dateFilterBatches.get(i).toString()); doLoadUserRating(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_user_rating", dateFilterBatches.get(i), dateFilterBatches.get(i + 1)); } } else { @@ -881,7 +882,8 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable, T " and pr.rating_ind = 1 " + eligibilityConstraint + " and p.project_category_id+111 = ur.phase_id) as lowest_rating " + - " from user_rating ur "; + " from user_rating ur "+ + "where "+eligibilityConstraint.replaceFirst("p.project_id","ur.last_rated_project_id"); if (endTime==null){ SELECT +=" where ur.create_date_time > ?"; } else { @@ -1377,7 +1379,7 @@ private void loadNewColumns3ForProjectFirstTime(String targetTable) throws Excep // load project_id for the existing project records in tcs_dw query.delete(0, query.length()); - query.append("SELECT project_id FROM project WHERE project_category_id IN " + LOAD_CATEGORIES); + query.append("SELECT project_id FROM " + targetTable +" WHERE project_category_id IN " + LOAD_CATEGORIES); selectExistingProjectToUpdatePS = prepareStatement(query.toString(), TARGET_DB); rs = selectExistingProjectToUpdatePS.executeQuery(); @@ -1559,6 +1561,7 @@ public void doLoadPublicProjects() throws Exception { public void doLoadPrivateProjects() throws Exception { if (fullLoad) { for (int i = 0; i < dateFilterBatches.size() - 1; i++) { + log.info("loading projects from "+dateFilterBatches.get(i).toString()); doLoadProjects(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_project", dateFilterBatches.get(i), dateFilterBatches.get(i + 1)); } } else { @@ -2101,7 +2104,7 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable, Tim update.setLong(62, rs.getLong("project_id")); - System.out.println("------------project id --------------------------"+rs.getLong("project_id")); + log.info("------------project id --------------------------"+rs.getLong("project_id")); int retVal = update.executeUpdate(); @@ -2232,9 +2235,11 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable, Tim } } else { - // we need to delete this project and all related objects in the database. - log.info("Found project to delete: " + rs.getLong("project_id")); - deleteProject(rs.getLong("project_id")); + if (endTime==null) { // if not a full load + // we need to delete this project and all related objects in the database. + log.info("Found project to delete: " + rs.getLong("project_id")); + deleteProject(rs.getLong("project_id")); + } } count++; } @@ -3825,6 +3830,7 @@ public void doLoadPublicDesignProjectResults() throws Exception { public void doLoadPrivateDesignProjectResults() throws Exception { if (fullLoad) { for (int i = 0; i < dateFilterBatches.size() - 1; i++) { + log.info("loading projects from "+dateFilterBatches.get(i).toString()); doLoadDesignProjectResults(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_design_project_result", dateFilterBatches.get(i), dateFilterBatches.get(i + 1)); } } else { From 92dc607655f91bc964af800b02d01a3f95ca99b9 Mon Sep 17 00:00:00 2001 From: Samir Date: Thu, 16 Apr 2020 09:47:35 +0200 Subject: [PATCH 38/95] disable skipping deleting projects for full load --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 3a490367d5a..de9137ea353 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -2235,11 +2235,9 @@ public void doLoadProjects(String eligibilityConstraint, String targetTable, Tim } } else { - if (endTime==null) { // if not a full load - // we need to delete this project and all related objects in the database. - log.info("Found project to delete: " + rs.getLong("project_id")); - deleteProject(rs.getLong("project_id")); - } + // we need to delete this project and all related objects in the database. + log.info("Found project to delete: " + rs.getLong("project_id")); + deleteProject(rs.getLong("project_id")); } count++; } From b270f327dfbfbd8544cdf169448a6e54e46b541a Mon Sep 17 00:00:00 2001 From: Samir Date: Mon, 4 May 2020 12:08:53 +0200 Subject: [PATCH 39/95] revert user rating changes --- .../topcoder/utilities/dwload/TCLoadTCS.java | 49 +++++-------------- 1 file changed, 11 insertions(+), 38 deletions(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index de9137ea353..0513feb5745 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -417,9 +417,7 @@ public void performLoad() throws Exception { doLoadContestProject(); - doLoadPublicUserRating(); - - doLoadPrivateUserRating(); + doLoadUserRating(); doLoadUserReliability(); @@ -831,27 +829,12 @@ public void doLoadUserReliability() throws Exception { } } - public void doLoadPublicUserRating() throws Exception { - doLoadUserRating(ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "user_rating", fLastLogTime, null); - } - - public void doLoadPrivateUserRating() throws Exception { - if (fullLoad) { - for (int i = 0; i < dateFilterBatches.size() - 1; i++) { - log.info("loading projects from "+dateFilterBatches.get(i).toString()); - doLoadUserRating(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_user_rating", dateFilterBatches.get(i), dateFilterBatches.get(i + 1)); - } - } else { - doLoadUserRating(WITH_ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT, "private_user_rating", fLastLogTime, null); - } - } - /** * Loads user ratings * * @throws Exception if any error occurs */ - public void doLoadUserRating(String eligibilityConstraint, String targetTable, Timestamp startTime, Timestamp endTime) throws Exception { + public void doLoadUserRating() throws Exception { log.info("load user rating"); PreparedStatement select = null; PreparedStatement insert = null; @@ -861,7 +844,7 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable, T try { long start = System.currentTimeMillis(); - String SELECT = "select ur.rating " + + final String SELECT = "select ur.rating " + " , ur.vol " + " , ur.rating_no_vol " + " , ur.num_ratings " + @@ -873,35 +856,25 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable, T " where pr.user_id = ur.user_id " + " and pr.project_id = p.project_id " + " and pr.rating_ind = 1 " + - eligibilityConstraint + + ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT + " and p.project_category_id+111 = ur.phase_id) as highest_rating " + " , (select min(pr.new_rating) " + " from project_result pr, project p " + " where pr.user_id = ur.user_id " + " and pr.project_id = p.project_id " + " and pr.rating_ind = 1 " + - eligibilityConstraint + + ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT + " and p.project_category_id+111 = ur.phase_id) as lowest_rating " + - " from user_rating ur "+ - "where "+eligibilityConstraint.replaceFirst("p.project_id","ur.last_rated_project_id"); - if (endTime==null){ - SELECT +=" where ur.create_date_time > ?"; - } else { - SELECT +=" where ur.create_date_time >= ? and ur.create_date_time < ?"; - } + " from user_rating ur " + + " where ur.mod_date_time > ?"; - final String UPDATE = "update " + targetTable + " set rating = ?, vol = ?, rating_no_vol = ?, num_ratings = ?, last_rated_project_id = ?, mod_date_time = CURRENT, highest_rating = ?, lowest_rating = ? " + + final String UPDATE = "update user_rating set rating = ?, vol = ?, rating_no_vol = ?, num_ratings = ?, last_rated_project_id = ?, mod_date_time = CURRENT, highest_rating = ?, lowest_rating = ? " + " where user_id = ? and phase_id = ?"; - final String INSERT = "insert into " + targetTable + " (user_id, rating, phase_id, vol, rating_no_vol, num_ratings, last_rated_project_id, mod_date_time, create_date_time, highest_rating, lowest_rating) " + + final String INSERT = "insert into user_rating (user_id, rating, phase_id, vol, rating_no_vol, num_ratings, last_rated_project_id, mod_date_time, create_date_time, highest_rating, lowest_rating) " + "values (?, ?, ?, ?, ?, ?, ?, CURRENT, CURRENT, ?, ?) "; select = prepareStatement(SELECT, SOURCE_DB); - if (endTime==null) { - select.setTimestamp(1, startTime); - } else { - select.setTimestamp(1, startTime); - select.setTimestamp(2, endTime); - } + select.setTimestamp(1, fLastLogTime); insert = prepareStatement(INSERT, TARGET_DB); update = prepareStatement(UPDATE, TARGET_DB); @@ -950,7 +923,7 @@ public void doLoadUserRating(String eligibilityConstraint, String targetTable, T } catch (SQLException sqle) { DBMS.printSqlException(true, sqle); - throw new Exception("Load of '" + targetTable + "' table failed. for user " + userId + " \n" + + throw new Exception("Load of 'user_rating' table failed. for user " + userId + " \n" + sqle.getMessage()); } finally { close(rs); From 33c991cba3dfbea838f84b79e06b2b8f2bfda8f7 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Mon, 11 May 2020 20:01:32 +0530 Subject: [PATCH 40/95] Made default value for full load equal to false and respective code update. --- conf/loadtcs.xml | 2 +- .../topcoder/utilities/dwload/TCLoadTCS.java | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/conf/loadtcs.xml b/conf/loadtcs.xml index 85d3954fc16..52f73bf14cd 100755 --- a/conf/loadtcs.xml +++ b/conf/loadtcs.xml @@ -6,7 +6,7 @@ com.topcoder.utilities.dwload.TCLoadTCS - + diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 0513feb5745..d50d057ab63 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -328,21 +328,24 @@ public boolean setParameters(Hashtable params) { String fullLoadStr = (String) params.get("full_load"); if (fullLoadStr!=null){ fullLoad = fullLoadStr.equals("true"); - dateFilterBatches = new ArrayList<>(); - try { - int batchDays = Integer.parseInt((String) params.get("batch_size_days")); - java.util.Date startDate = DATE_FORMATS[0].parse("01/01/2000 00:00"); - java.util.Date now = new java.util.Date(); - Calendar cal = Calendar.getInstance(); - while (startDate.getTime() Date: Tue, 12 May 2020 13:20:56 +0530 Subject: [PATCH 41/95] removed delete for private_user_rating as this table will no more be used because we are going to devise new solution for groupwise rating. But the logic needs to be updated once we have private ratings table defined. --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index d50d057ab63..5ec639b4df1 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -2919,7 +2919,6 @@ private void deleteProject(long projectId) throws SQLException { simpleDelete("streak", "start_project_id", projectId); simpleDelete("streak", "end_project_id", projectId); simpleDelete("user_rating", "last_rated_project_id", projectId); - simpleDelete("private_user_rating", "last_rated_project_id", projectId); simpleDelete("contest_project_xref", "project_id", projectId); simpleDelete("project_review", "project_id", projectId); simpleDelete("submission", "project_id", projectId); From f361ac98bc9b49ff27da7837be42595db146a088 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Wed, 13 May 2020 19:03:13 +0530 Subject: [PATCH 42/95] Corrected error in sql syntax --- src/main/com/topcoder/utilities/dwload/TCLoadTCS.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java index 5ec639b4df1..cb4b6ce5e02 100755 --- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java +++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java @@ -3141,7 +3141,7 @@ public void doLoadProjectResults(String eligibilityConstraint, String targetTabl if (endTime==null){ PROJECTS_SELECT+= "and p.project_id = pi.project_id " + - "and p.project_id = pr.project_id" + + "and p.project_id = pr.project_id " + "and pi.project_info_type_id = 1 " + "and cv.comp_vers_id= pi.value " + "and cc.component_id = cv.component_id " + From 0a18eb21638c35c1800b792502bb334f054c97cb Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 7 Aug 2020 10:14:31 -0400 Subject: [PATCH 43/95] Rename mediaRequestForm.jsp to mediaRequestForm.jsp.20200807 Removing this page since it is deprecated. --- .../{mediaRequestForm.jsp => mediaRequestForm.jsp.20200807} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/main/com/topcoder/web/tc/view/pressroom/{mediaRequestForm.jsp => mediaRequestForm.jsp.20200807} (99%) diff --git a/src/main/com/topcoder/web/tc/view/pressroom/mediaRequestForm.jsp b/src/main/com/topcoder/web/tc/view/pressroom/mediaRequestForm.jsp.20200807 similarity index 99% rename from src/main/com/topcoder/web/tc/view/pressroom/mediaRequestForm.jsp rename to src/main/com/topcoder/web/tc/view/pressroom/mediaRequestForm.jsp.20200807 index 79d27a5b59c..2644f3cbc9a 100644 --- a/src/main/com/topcoder/web/tc/view/pressroom/mediaRequestForm.jsp +++ b/src/main/com/topcoder/web/tc/view/pressroom/mediaRequestForm.jsp.20200807 @@ -156,4 +156,4 @@ - \ No newline at end of file + From e386c957140a04a0c18e39aa997a083f43d791aa Mon Sep 17 00:00:00 2001 From: ajefts Date: Fri, 21 Aug 2020 11:35:25 -0400 Subject: [PATCH 44/95] Updating segment.io script Note: This is already updated in prod. --- src/main/com/topcoder/web/jsp/foot.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/com/topcoder/web/jsp/foot.jsp b/src/main/com/topcoder/web/jsp/foot.jsp index 1e985a33498..c9d96137d4f 100755 --- a/src/main/com/topcoder/web/jsp/foot.jsp +++ b/src/main/com/topcoder/web/jsp/foot.jsp @@ -154,7 +154,7 @@ <%-- Analytics --%> + - + diff --git a/src/main/com/topcoder/web/jsp/style.jsp b/src/main/com/topcoder/web/jsp/style.jsp index 5c126dea7ab..db302f25bad 100644 --- a/src/main/com/topcoder/web/jsp/style.jsp +++ b/src/main/com/topcoder/web/jsp/style.jsp @@ -14,6 +14,8 @@ <% String key = request.getParameter("key"); Boolean isNewStyle = request.getAttribute("isNewStyle") == null ? false : (Boolean) request.getAttribute("isNewStyle"); + + String reskin = request.getParameter("reskin"); %> <% if (!isNewStyle) { %> <% if (key.equals("tc_old")) { %> @@ -225,3 +227,15 @@ <% } %> + +<% if (reskin != null) { %> + + + + <% if (reskin.equals("paymentHistory")) { %> + + + + + <% } %> +<% } %> diff --git a/src/main/com/topcoder/web/jsp/top.jsp b/src/main/com/topcoder/web/jsp/top.jsp index d19e686f60c..3c0d84abd7a 100755 --- a/src/main/com/topcoder/web/jsp/top.jsp +++ b/src/main/com/topcoder/web/jsp/top.jsp @@ -33,6 +33,8 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="tc-webtags.tld" prefix="tc-webtag" %> +" var="isReskin"/> + <% SessionInfo sessionInfo = (SessionInfo)request.getAttribute(BaseServlet.SESSION_INFO_KEY); String level1 = request.getParameter("level1")==null?"competition":request.getParameter("level1"); @@ -55,6 +57,15 @@ + +

+ +
+ diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 3895b3648cb..074e1768f5a 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -50,6 +50,7 @@ + @@ -64,6 +65,7 @@ + + @@ -350,7 +417,7 @@ -
+
No Payments Found
@@ -375,7 +442,13 @@
- + +
+ + + + + From 58defa6ba05af03a4c9c07cdc7fdde294d6bb8c7 Mon Sep 17 00:00:00 2001 From: lunarkid Date: Tue, 28 Jun 2022 15:14:21 +0700 Subject: [PATCH 80/95] improvement(reskin-payment): add meta viewport --- .../com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 074e1768f5a..bd4196f2562 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -55,6 +55,7 @@ + TopCoder - PACTS <% From a576099a2a805eeb29209e8f206e667eaab11fd5 Mon Sep 17 00:00:00 2001 From: lunarkid Date: Wed, 29 Jun 2022 22:43:49 +0700 Subject: [PATCH 81/95] improvement(reskin-payment): payment summary --- src/main/com/topcoder/web/jsp/style.jsp | 5 + .../request/member/PaymentStatusSummary.java | 46 ++++++- .../pacts/client/PaymentStatusSummary.jsp | 114 ++++++++++++++++-- 3 files changed, 153 insertions(+), 12 deletions(-) diff --git a/src/main/com/topcoder/web/jsp/style.jsp b/src/main/com/topcoder/web/jsp/style.jsp index db302f25bad..33a2b7dfd75 100644 --- a/src/main/com/topcoder/web/jsp/style.jsp +++ b/src/main/com/topcoder/web/jsp/style.jsp @@ -237,5 +237,10 @@ + <% } else if (reskin.equals("paymentStatusSummary")) { %> + + + + <% } %> <% } %> diff --git a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java index a1b44e09c7f..88727897693 100644 --- a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java +++ b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java @@ -1,6 +1,9 @@ package com.topcoder.web.tc.controller.legacy.pacts.controller.request.member; import java.util.Map; +import java.util.List; +import java.util.ArrayList; +import java.util.HashMap; import com.topcoder.shared.dataAccess.DataAccess; import com.topcoder.shared.dataAccess.DataAccessInt; @@ -14,6 +17,12 @@ import com.topcoder.web.tc.Constants; import com.topcoder.web.tc.controller.legacy.pacts.common.PactsConstants; +import com.topcoder.web.tc.controller.legacy.pacts.bean.DataInterfaceBean; +import com.topcoder.web.tc.controller.legacy.pacts.common.PactsConstants; +import com.topcoder.web.ejb.pacts.BasePayment; +import com.topcoder.web.ejb.pacts.payments.PaymentStatusFactory; +import com.topcoder.web.ejb.pacts.payments.PaymentStatusFactory.PaymentStatus; + /** * @author VolodymyrK */ @@ -36,6 +45,8 @@ protected void businessProcessing() throws TCWebException { Map m = dai.getData(r); ResultSetContainer summary = (ResultSetContainer) m.get("payment_status_summary"); + getRequest().setAttribute("NUM_PENDING", this.getPendingPaymentsNumber()); + getRequest().setAttribute(PAYMENT_STATUS_SUMMARY, summary); setNextPage(PactsConstants.PAYMENT_STATUS_SUMMARY_JSP); setIsNextPageInContext(true); @@ -44,4 +55,37 @@ protected void businessProcessing() throws TCWebException { } } -} \ No newline at end of file + private int getPendingPaymentsNumber() throws Exception { + DataInterfaceBean dib = new DataInterfaceBean(); + + Map criteria = new HashMap(); + long userId = getUser().getId(); + criteria.put(PactsConstants.USER_ID, String.valueOf(userId)); + + List payments = dib.findCoderPayments(criteria); + + List removePayments = new ArrayList(); + for (BasePayment payment : payments) { + if (payment.getPaymentType() == 3 || payment.getPaymentType() == 5) { + removePayments.add(payment); + } else { + if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.CANCELLED_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.EXPIRED_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.PAID_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.DELETED_PAYMENT_STATUS))) { + removePayments.add(payment); + } + } + } + payments.removeAll(removePayments); + + List paymentPendings = new ArrayList(); + for (BasePayment payment : payments) { + if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) { + paymentPendings.add(payment); + } + } + + return paymentPendings.size(); + } +} diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp index b09dd1abeb4..448ae63a5bb 100644 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp @@ -12,15 +12,20 @@ <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + +" var="numPending" /> + + TopCoder - PACTS + @@ -32,7 +37,13 @@ + + + +
+ + @@ -51,25 +62,92 @@ -
-
+

+ + +
+ +
+ + + + @@ -79,9 +157,9 @@ - - - + + + @@ -89,10 +167,10 @@ double total = 0;%> "> - - + totalRow"> + + + + @@ -115,6 +197,10 @@
Payment StatusNet Amount
Payment StatusNet Amount
+ + <% if (resultRow.getDoubleItem("net_amount") > 0) { total += resultRow.getDoubleItem("net_amount"); }%> @@ -102,8 +180,12 @@ <%even = !even;%> -
Total Total: 
+ + +
<%-- // end .table-container --%> +

@@ -135,7 +221,13 @@ - + +
+ + + + + From db89038e0ef2afd2e6d25bcbd04da9c236451d33 Mon Sep 17 00:00:00 2001 From: lunarkid Date: Wed, 29 Jun 2022 22:50:14 +0700 Subject: [PATCH 82/95] improvement(reskin-payment): view all, view pending --- .../request/member/PaymentHistory.java | 13 +- .../tc/view/pacts/client/PaymentHistory.jsp | 378 ++++++++++++++++-- 2 files changed, 353 insertions(+), 38 deletions(-) diff --git a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java index 3214f4e5ead..746cca12986 100644 --- a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java +++ b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java @@ -123,7 +123,7 @@ protected void businessProcessing() throws TCWebException { // Normalizes optional parameters and sets defaults if ("".equals(numRecords)) { - numRecords = "20"; + numRecords = "10"; } else if (Integer.parseInt(numRecords) > 200) { numRecords = "200"; } @@ -176,6 +176,17 @@ protected void businessProcessing() throws TCWebException { removeDuplicateReasons(payments); } + List paymentPendings = new ArrayList(); + for (BasePayment payment : payments) { + if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) { + paymentPendings.add(payment); + } + } + + getRequest().setAttribute("NUM_TOTAL", payments.size()); + getRequest().setAttribute("NUM_PER_PAGE", numRecords); + getRequest().setAttribute("NUM_PENDING", paymentPendings.size()); + if (exportToExcel) { produceXLS(payments); } else { diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index bd4196f2562..e0c472cb74c 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -50,7 +50,13 @@ + +" var="numTotal" /> +" var="numPerPage" /> +" var="numPending" /> + + @@ -91,6 +97,61 @@ myForm.submit(); } + function onPageChange(pageIndex) { + var myForm = document.f; + myForm.<%=DataAccessConstants.START_RANK%>.value = (pageIndex - 1) * parseInt(myForm.<%=DataAccessConstants.NUMBER_RECORDS%>.value) + 1; + myForm.<%=DataAccessConstants.SORT_COLUMN%>.value ='<%=request.getParameter(DataAccessConstants.SORT_COLUMN)==null?"":request.getParameter(DataAccessConstants.SORT_COLUMN)%>'; + myForm.<%=DataAccessConstants.SORT_DIRECTION%>.value = '<%=request.getParameter(DataAccessConstants.SORT_DIRECTION)==null?"":request.getParameter(DataAccessConstants.SORT_DIRECTION)%>'; + + myForm.submit(); + } + function onPerPageChange(perPage) { + var myForm = document.f; + myForm.<%=DataAccessConstants.START_RANK%>.value = 0; + myForm.<%=DataAccessConstants.NUMBER_RECORDS%>.value = perPage; + myForm.<%=DataAccessConstants.SORT_COLUMN%>.value ='<%=request.getParameter(DataAccessConstants.SORT_COLUMN)==null?"":request.getParameter(DataAccessConstants.SORT_COLUMN)%>'; + myForm.<%=DataAccessConstants.SORT_DIRECTION%>.value = '<%=request.getParameter(DataAccessConstants.SORT_DIRECTION)==null?"":request.getParameter(DataAccessConstants.SORT_DIRECTION)%>'; + + myForm.submit(); + } + + var init = ${isReskin}; + if (init) { + window.addEventListener('load', function onInit() { + var inputEl = document.querySelector('input#<%=DataAccessConstants.NUMBER_RECORDS%>'); + inputEl.setAttribute('readonly', '${isReskin ? "true" : "false"}'); + inputEl.setAttribute('autocomplete', '${isReskin ? "off" : "on"}') + + $('.payable').click(function() { + var paymentId = this.value; + var checked = this.checked; + if (checked) { + $('[data-name="${PAYMENT_ID}"][data-value="'+paymentId+'"]').removeClass('checked'); + $('[data-name="${PAYMENT_ID}"][data-value="'+paymentId+'"]').addClass('checked'); + } else { + $('[data-name="${PAYMENT_ID}"][data-value="'+paymentId+'"]').removeClass('checked'); + } + }); + + $('[data-name="${PAYMENT_ID}"]').click(function () { + var paymentId = this.getAttribute('data-value'); + $('.payable[value="' + paymentId + '"]').click(); + }); + + $('.payable').click(function() { + var hasSelected = false; + $('.payable:checked').each(function () { + hasSelected = true; + }); + + if (hasSelected) { + $('.table-pagination').addClass('hiddenOnSelected'); + } else { + $('.table-pagination').removeClass('hiddenOnSelected'); + } + }); + }); + } @@ -165,17 +226,18 @@ <%-- mobile dropdown --%> +
+ <%-- Mobile sort-button --%> + " + > + + +
@@ -218,9 +288,10 @@ -
+
@@ -246,28 +317,45 @@ [Check All | Uncheck All]
+

<% boolean even = true;%> + + <%-- TABLE --%> + +
+ + + + + + + + + + + + - + - - - - - - - - + + + + + + + @@ -275,8 +363,8 @@ - "> - ${(payment.currentStatus.id eq OWED or payment.currentStatus.id eq ACCRUING) ? 'highlight' : '' }"> + - - - - + + + - - <% even = !even;%>
Payments
" >Description" >Type" >Create Date" >Net Payment" >Status" >Release Date - +
" >Description" >Type" >Create Date" >Net Payment" >Status" >Release Date + <%----%> " >Date Paid - + <%----%>  
+
${payment.description} @@ -313,28 +401,29 @@ ${payment.paymentTypeDesc}${payment.currentStatus.desc} + ${payment.paymentTypeDesc}${payment.currentStatus.desc}
- ${reason.desc}
- + + + + <%-- Paid, Entered into Payment System: checked, disabled--%> - + <%-- Owed, Accruing --%> @@ -347,6 +436,7 @@ <%-- Negative Payment: checked, readonly --%> + <%-- All other cases: un-checked, normal --%> @@ -360,27 +450,165 @@ <%-- All other cases: un-checked, disabled--%> - + + +
- + + +
+
+ + <%-- LIST --%> + +
+ +
+ + +
+
Type
+
${paymentItem.paymentTypeDesc}
+
+ +
+
Create Date
+
+
+ +
+
Net Payment
+
+
+ +
+
Status
+
+ ${paymentItem.currentStatus.desc} + +
- ${reason.desc} +
+
+
+ +
+
Release Date
+
+
+ + + +
+
+
+ + + + <%-- Paid, Entered into Payment System: checked, disabled--%> + + + + <%-- Owed, Accruing --%> + + + <%-- Payment release date is not reached yet: un-checked, disabled --%> + + + + <%-- Negative Payment: checked, readonly --%> + + + + <%-- All other cases: un-checked, normal --%> + + + + + + <%-- All other cases: un-checked, disabled--%> + + + +
+
+
+
+
+
+ + <%-- FOOTER ACTIONS --%> + + <%-- Mobile sort-button --%> - " - > - - + + " + > + + + From 99afd11f6356438302ea2fa86c1f0dba50020b3b Mon Sep 17 00:00:00 2001 From: lunarkid Date: Thu, 21 Jul 2022 12:30:57 +0700 Subject: [PATCH 88/95] reskin-payment: back button to challenges --- .../com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp | 3 ++- .../web/tc/view/pacts/client/PaymentStatusSummary.jsp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 625c82249e8..18d5b3c6066 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -21,6 +21,7 @@ <%@ page import="com.topcoder.web.ejb.pacts.payments.EnteredIntoPaymentSystemPaymentStatus" %> <%@ page import="com.topcoder.web.ejb.pacts.payments.AccruingPaymentStatus" %> <%@ page import="com.topcoder.web.ejb.pacts.payments.OwedPaymentStatus" %> +<%@ page import="com.topcoder.shared.util.ApplicationServer" %> <%@ page import="java.util.Arrays" %> <%@ page language="java" %> @@ -196,7 +197,7 @@ <% } %> - + diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp index 666a8c9ca7c..74f5767a38b 100644 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp @@ -2,8 +2,8 @@ <%@ page language="java" import="com.topcoder.shared.dataAccess.resultSet.ResultSetContainer, com.topcoder.shared.dataAccess.DataAccessConstants, + com.topcoder.shared.util.ApplicationServer, com.topcoder.web.tc.Constants" %> - <%@ page language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="rsc-taglib.tld" prefix="rsc" %> @@ -74,7 +74,7 @@ - + From e12dee08356a1deeee9aafefdac9e2e95dec1bbd Mon Sep 17 00:00:00 2001 From: lunarkid Date: Thu, 4 Aug 2022 10:46:09 +0700 Subject: [PATCH 89/95] fix: pagination after click checkbox --- .../tc/view/pacts/client/PaymentHistory.jsp | 53 +++++++------------ 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 18d5b3c6066..c6a083af2de 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -5,7 +5,7 @@ - - Description: This page displays the payments for current user. - - - Version 1.1 (Member Payments Automation assembly) changes: + - Version 1.1 (Member Payments Automation assembly) changes: - added logic for displaying payment's release date. - added controls for data pagination parameters setting. - fixed a bug with passing sr, er parameters when sorting the paginated data. @@ -80,7 +80,7 @@ USER_PAYMENT_METHOD = ${userPaymentMethod eq null ? 'null' : userPaymentMethod}; MINIMUM_PAYMENT_ACCRUAL_AMOUNT = ${MINIMUM_PAYMENT_ACCRUAL_AMOUNT}; PAY_ME_CONFIRMATION_TEMPLATE = '${paymentConfirmationTemplate}'; - + function next() { var myForm = document.f; myForm.<%=DataAccessConstants.START_RANK%>.value = ${requestScope[defaults][startRank]} + parseInt(myForm.<%=DataAccessConstants.NUMBER_RECORDS%>.value); @@ -138,19 +138,6 @@ var paymentId = this.getAttribute('data-value'); $('.payable[value="' + paymentId + '"]').click(); }); - - $('.payable').click(function() { - var hasSelected = false; - $('.payable:checked').each(function () { - hasSelected = true; - }); - - if (hasSelected) { - $('.table-pagination').addClass('hiddenOnSelected'); - } else { - $('.table-pagination').removeClass('hiddenOnSelected'); - } - }); }); } @@ -309,7 +296,7 @@
- +
@@ -321,7 +308,7 @@ << prev - + next >> @@ -378,9 +365,9 @@   - + - + ${(payment.currentStatus.id eq OWED or payment.currentStatus.id eq ACCRUING) ? 'highlight' : '' }"> @@ -397,34 +384,34 @@ (${payment.installmentNumber}rd (${payment.installmentNumber}th - installment, total amount=${payment.totalAmount}) + installment, total amount=${payment.totalAmount}) - + - ${payment.description} + ${payment.description} - ${payment.description} + ${payment.description} - ${payment.description} + ${payment.description} - ${payment.description} - + ${payment.description} + ${payment.description} - - + + ${payment.paymentTypeDesc} ${payment.currentStatus.desc} - +
- ${reason.desc}
@@ -628,13 +615,13 @@
Total: -
- +
+ " /> - +
@@ -719,7 +706,7 @@
- +
From 9a41a36e0cc89c2ec40129a44462d704f054e5da Mon Sep 17 00:00:00 2001 From: lunarkid Date: Thu, 4 Aug 2022 21:06:33 +0700 Subject: [PATCH 90/95] fix: pending count differences --- .../request/member/PaymentHistory.java | 121 +++++++++--------- .../request/member/PaymentStatusSummary.java | 7 +- 2 files changed, 69 insertions(+), 59 deletions(-) diff --git a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java index 746cca12986..06f51b632d8 100644 --- a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java +++ b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java @@ -43,10 +43,10 @@ *

* Version 1.1 (Member Payments Automation Assembly 1.0) Change notes: *

    - *
  1. Updated {@link #insertSheetData(Sheet, List)} method to include new Release Date column into + *
  2. Updated {@link #insertSheetData(Sheet, List)} method to include new Release Date column into * generated Excel worksheet.
  3. - *
  4. Updated {@link #businessProcessing()} method to parse new {@link DataAccessConstants#NUMBER_RECORDS} - * parameter and fix the bug with parsing {@link DataAccessConstants#START_RANK} and + *
  5. Updated {@link #businessProcessing()} method to parse new {@link DataAccessConstants#NUMBER_RECORDS} + * parameter and fix the bug with parsing {@link DataAccessConstants#START_RANK} and * {@link DataAccessConstants#END_RANK} parameters.
  6. *
  7. Added {@link #USER_PAYMENT_METHOD} constant.
  8. *
  9. Added {@link #PAYMENT_CONFIRMATION_TEMPLATE} constant.
  10. @@ -67,7 +67,7 @@ public class PaymentHistory extends BaseProcessor implements PactsConstants { /** *

    A String providing the name for request attribute holding the ID of a payment method preferred by * current user.

    - * + * * @since 1.1 */ public static final String USER_PAYMENT_METHOD = "userPaymentMethod"; @@ -81,29 +81,29 @@ public class PaymentHistory extends BaseProcessor implements PactsConstants { public static final String PAYMENT_CONFIRMATION_TEMPLATE = "paymentConfirmationTemplate"; /** - * + * */ public static final String PAYMENT_ID = "paymentId"; - + public static final String CODER = "cr"; private static final int DESCRIPTION_COL = 1; private static final int TYPE_COL = 2; private static final int CREATE_DATE_COL = 3; private static final int NET_PAYMENT_COL = 4; private static final int STATUS_COL = 5; - + /** *

    An int referencing the column with release dates for payments.

    - * + * * @since 1.1 */ private static final int RELEASE_DATE_COL = 6; - + private static final int PAID_DATE_COL = 7; /** *

    Processes the incoming request. Retrieves user payments and binds them to request.

    - * + * * @throws TCWebException if an unexpected error occurs. */ protected void businessProcessing() throws TCWebException { @@ -113,14 +113,14 @@ protected void businessProcessing() throws TCWebException { String sortColStr = StringUtils.checkNull(getRequest().getParameter(DataAccessConstants.SORT_COLUMN)); boolean exportToExcel = "true".equals(getRequest().getParameter(XLS_FORMAT)); String numRecords = StringUtils.checkNull(getRequest().getParameter(DataAccessConstants.NUMBER_RECORDS)); - + boolean sortAscending= "asc".equals(getRequest().getParameter(DataAccessConstants.SORT_DIRECTION)); int sortCol = 3; - + if (sortColStr.trim().length() > 0) { sortCol = Integer.parseInt(sortColStr); } - + // Normalizes optional parameters and sets defaults if ("".equals(numRecords)) { numRecords = "10"; @@ -137,27 +137,27 @@ protected void businessProcessing() throws TCWebException { String endRank = String.valueOf(Integer.parseInt(startRank) + Integer.parseInt(numRecords) - 1); setDefault(DataAccessConstants.END_RANK, endRank); - + DataInterfaceBean dib = new DataInterfaceBean(); - + Map criteria = new HashMap(); long userId = getUser().getId(); criteria.put(PactsConstants.USER_ID, String.valueOf(userId)); List payments = dib.findCoderPayments(criteria); - + List removePayments = new ArrayList(); + List removeNonPending = new ArrayList(); + for (BasePayment payment : payments) { if (payment.getPaymentType() == 3 || payment.getPaymentType() == 5) { removePayments.add(payment); } else { - if (!fullList && !exportToExcel) { - if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.CANCELLED_PAYMENT_STATUS)) || - payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.EXPIRED_PAYMENT_STATUS)) || - payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.PAID_PAYMENT_STATUS))) { - removePayments.add(payment); - } + if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.CANCELLED_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.EXPIRED_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.PAID_PAYMENT_STATUS))) { + removeNonPending.add(payment); } // Deleted payments should not be shown either way. @@ -166,36 +166,43 @@ protected void businessProcessing() throws TCWebException { } } } - + payments.removeAll(removePayments); - + + int totalPayment = payments.size(); + + if (!fullList && !exportToExcel) { + if (removeNonPending.size() > 0) { + payments.removeAll(removeNonPending); + } + } + + int PaymentsPending = totalPayment - removeNonPending.size(); + // sort the result in the first place sortResult(payments, sortCol, sortAscending); - + if ("on".equalsIgnoreCase(com.topcoder.web.tc.Constants.GLOBAL_AD_FLAG)) { removeDuplicateReasons(payments); } - List paymentPendings = new ArrayList(); - for (BasePayment payment : payments) { - if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) { - paymentPendings.add(payment); - } + if (!fullList && !exportToExcel) { + getRequest().setAttribute("NUM_TOTAL", PaymentsPending); + } else { + getRequest().setAttribute("NUM_TOTAL", totalPayment); } - - getRequest().setAttribute("NUM_TOTAL", payments.size()); getRequest().setAttribute("NUM_PER_PAGE", numRecords); - getRequest().setAttribute("NUM_PENDING", paymentPendings.size()); + getRequest().setAttribute("NUM_PENDING", PaymentsPending); if (exportToExcel) { produceXLS(payments); } else { // now crop payments = cropResult(payments, Integer.parseInt(startRank), Integer.parseInt(endRank)); - + setDefault(DataAccessConstants.SORT_COLUMN, sortCol + ""); setDefault(DataAccessConstants.SORT_DIRECTION, getRequest().getParameter(DataAccessConstants.SORT_DIRECTION)); - + getRequest().setAttribute(PAYMENTS, payments); getRequest().setAttribute(CODER, userId + ""); getRequest().setAttribute(FULL_LIST, Boolean.valueOf(fullList)); @@ -209,22 +216,22 @@ protected void businessProcessing() throws TCWebException { s.addDefault(RELEASE_DATE_COL, "desc"); s.addDefault(PAID_DATE_COL, "desc"); getRequest().setAttribute(SortInfo.REQUEST_KEY, s); - + // Get user's payment method preferences Long userPaymentMethod = dib.getUserPaymentMethod(userId); getRequest().setAttribute(USER_PAYMENT_METHOD, userPaymentMethod); if (userPaymentMethod != null) { if (userPaymentMethod == PAYPAL_PAYMENT_METHOD_ID) { getRequest() - .setAttribute(PAYMENT_CONFIRMATION_TEMPLATE, + .setAttribute(PAYMENT_CONFIRMATION_TEMPLATE, Constants.PAYME_CONFIRMATION_MESSAGE_TEMPLATE_PAYPAL); } else if (userPaymentMethod == PAYONEER_PAYMENT_METHOD_ID) { getRequest() - .setAttribute(PAYMENT_CONFIRMATION_TEMPLATE, + .setAttribute(PAYMENT_CONFIRMATION_TEMPLATE, Constants.PAYME_CONFIRMATION_MESSAGE_TEMPLATE_PAYONEER); } else if (userPaymentMethod == WESTERN_UNION_PAYMENT_METHOD_ID) { getRequest() - .setAttribute(PAYMENT_CONFIRMATION_TEMPLATE, + .setAttribute(PAYMENT_CONFIRMATION_TEMPLATE, Constants.PAYME_CONFIRMATION_MESSAGE_TEMPLATE_WESTERN_UNION); } } @@ -300,12 +307,12 @@ private void insertSheetData(Sheet sheet, List payments) { } /** - *

    Gets the items for the specified range within the specified list.

    - * - * @param result a List providing the data. + *

    Gets the items for the specified range within the specified list.

    + * + * @param result a List providing the data. * @param startRank an int providing the index of starting item. * @param endRank an int providing the index of last item. - * @return a List listing the items within the specified range. + * @return a List listing the items within the specified range. */ private List cropResult(List result, int startRank, int endRank) { Boolean croppedDataAfter = Boolean.TRUE; @@ -313,9 +320,9 @@ private List cropResult(List result, int startRank, int endRank) { endRank = result.size(); croppedDataAfter = Boolean.FALSE; } - getRequest().setAttribute("croppedDataAfter", croppedDataAfter); + getRequest().setAttribute("croppedDataAfter", croppedDataAfter); getRequest().setAttribute("croppedDataBefore", new Boolean(startRank > 1)); - + if (result.size() > 0) { if (startRank <= endRank) { @@ -337,7 +344,7 @@ protected void removeDuplicateReasons(List result) { if (result.size() == 0) { return; } - + for (BasePayment bp : result) { if (bp.getCurrentStatus().getReasons().contains(AvailableStatusReason.NO_HARD_COPY_AD_REASON.getStatusReason()) && bp.getCurrentStatus().getReasons().contains(AvailableStatusReason.NO_SIGNED_GLOBAL_AD_REASON.getStatusReason())) { @@ -348,7 +355,7 @@ protected void removeDuplicateReasons(List result) { /** *

    Sorts the specified payments against specified column in specified order.

    - * + * * @param result a list of payments to sort. * @param sortCol a number of column to sort against. * @param sortAscending true if sorting is to be ascending; false if descending. @@ -374,10 +381,10 @@ public int compare(Object arg0, Object arg1) { public int compare(Object arg0, Object arg1) { Date date0 = ((BasePayment) arg0).getCreateDate(); Date date1 = ((BasePayment) arg1).getCreateDate(); - if (date0 == null && date1 == null) return 0; - if (date0 == null && date1 != null) return -1; - if (date0 != null && date1 == null) return 1; - + if (date0 == null && date1 == null) return 0; + if (date0 == null && date1 != null) return -1; + if (date0 != null && date1 == null) return 1; + return date0.compareTo(date1); } }); @@ -388,7 +395,7 @@ public int compare(Object arg0, Object arg1) { if (((BasePayment) arg0).getNetAmount() == ((BasePayment) arg1).getNetAmount()) { return 0; } - + return ((BasePayment) arg0).getNetAmount() < ((BasePayment) arg1).getNetAmount() ? -1 : 1; } }); @@ -414,14 +421,14 @@ public int compare(Object arg0, Object arg1) { }); break; case PAID_DATE_COL: - Collections.sort(result, new Comparator() { + Collections.sort(result, new Comparator() { public int compare(Object arg0, Object arg1) { Date date0 = ((BasePayment) arg0).getPaidDate(); Date date1 = ((BasePayment) arg1).getPaidDate(); - if (date0 == null && date1 == null) return 0; - if (date0 == null && date1 != null) return -1; - if (date0 != null && date1 == null) return 1; - + if (date0 == null && date1 == null) return 0; + if (date0 == null && date1 != null) return -1; + if (date0 != null && date1 == null) return 1; + return date0.compareTo(date1); } }); diff --git a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java index 88727897693..b846401c95a 100644 --- a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java +++ b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java @@ -32,7 +32,7 @@ public class PaymentStatusSummary extends BaseProcessor implements PactsConstant public static final String CODER = "cr"; private static final int TYPE_COL = 1; private static final int NET_PAYMENT_COL = 2; - + protected void businessProcessing() throws TCWebException { try { // Prepare request for data retrieval @@ -81,7 +81,10 @@ private int getPendingPaymentsNumber() throws Exception { List paymentPendings = new ArrayList(); for (BasePayment payment : payments) { - if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) { + if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ENTERED_INTO_PAYMENT_SYSTEM_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ACCRUING_PAYMENT_STATUS)) || + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ON_HOLD_PAYMENT_STATUS))) { paymentPendings.add(payment); } } From 882a6f0e6f370b733529144adb8c9779b0e3db72 Mon Sep 17 00:00:00 2001 From: lunarkid Date: Thu, 4 Aug 2022 22:51:32 +0700 Subject: [PATCH 91/95] fix: display 100 items --- .../tc/view/pacts/client/PaymentHistory.jsp | 102 +++++++++--------- 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index c6a083af2de..1f8e89f0388 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -298,7 +298,7 @@ id="PaymentHistoryForm"> - +
    [Check All | Uncheck All] @@ -623,58 +623,56 @@ " />
    - - - - << prev - - - - - - - << prev - - - - - -
    - - - - - ${i.index} - -
    -
    + + + << prev + + + + + + + << prev + + + - - - next >> - - - - - - - next >> - - - -
    + +
    + + + + + ${i.index} + +
    + + + + next >> + + + + + + + next >> + + + +
    View   From 825b57300228ed98470147807a19f3476befae7b Mon Sep 17 00:00:00 2001 From: lunarkid Date: Fri, 5 Aug 2022 20:08:17 +0700 Subject: [PATCH 92/95] fix: pay me button disabled --- .../web/tc/view/pacts/client/PaymentHistory.jsp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 1f8e89f0388..1ae91111bd9 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -138,6 +138,18 @@ var paymentId = this.getAttribute('data-value'); $('.payable[value="' + paymentId + '"]').click(); }); + + $('.payable').click(function() { + var hasSelected = false; + $('.payable:checked').each(function () { + hasSelected = true; + }); + if (hasSelected) { + $('#payMe').prop("disabled", false); + } else { + $('#payMe').prop("disabled", true); + } + }); }); } From 5f4460d402fd5f6d8aab9154b30340f6e566c292 Mon Sep 17 00:00:00 2001 From: lunarkid Date: Thu, 11 Aug 2022 08:35:40 +0700 Subject: [PATCH 93/95] fix: after sort pagination missing --- .../com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 1ae91111bd9..203229903b0 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -489,6 +489,7 @@
    +
    Description
    From c26ee99f23d8e1c1e045f12dde2e2f4663765a0e Mon Sep 17 00:00:00 2001 From: lunarkid <4476442+dedywahyudi@users.noreply.github.com> Date: Mon, 15 Aug 2022 23:00:42 +0700 Subject: [PATCH 94/95] fix: view pending count tab --- .../request/member/PaymentHistory.java | 35 +++++++------------ .../request/member/PaymentStatusSummary.java | 3 +- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java index 06f51b632d8..75471ed4d7a 100644 --- a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java +++ b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java @@ -154,31 +154,16 @@ protected void businessProcessing() throws TCWebException { if (payment.getPaymentType() == 3 || payment.getPaymentType() == 5) { removePayments.add(payment); } else { - if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.CANCELLED_PAYMENT_STATUS)) || - payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.EXPIRED_PAYMENT_STATUS)) || - payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.PAID_PAYMENT_STATUS))) { + if (!(payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) && + !(payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ENTERED_INTO_PAYMENT_SYSTEM_PAYMENT_STATUS))) && + !(payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ACCRUING_PAYMENT_STATUS)))) { removeNonPending.add(payment); } - - // Deleted payments should not be shown either way. - if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.DELETED_PAYMENT_STATUS))) { - removePayments.add(payment); - } } } payments.removeAll(removePayments); - int totalPayment = payments.size(); - - if (!fullList && !exportToExcel) { - if (removeNonPending.size() > 0) { - payments.removeAll(removeNonPending); - } - } - - int PaymentsPending = totalPayment - removeNonPending.size(); - // sort the result in the first place sortResult(payments, sortCol, sortAscending); @@ -186,13 +171,19 @@ protected void businessProcessing() throws TCWebException { removeDuplicateReasons(payments); } + int totalPayment = payments.size(); + if (!fullList && !exportToExcel) { - getRequest().setAttribute("NUM_TOTAL", PaymentsPending); - } else { - getRequest().setAttribute("NUM_TOTAL", totalPayment); + if (removeNonPending.size() > 0) { + payments.removeAll(removeNonPending); + } } + + int pendingPayments = totalPayment - removeNonPending.size(); + + getRequest().setAttribute("NUM_TOTAL", payments.size()); getRequest().setAttribute("NUM_PER_PAGE", numRecords); - getRequest().setAttribute("NUM_PENDING", PaymentsPending); + getRequest().setAttribute("NUM_PENDING", pendingPayments); if (exportToExcel) { produceXLS(payments); diff --git a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java index b846401c95a..52c8d0ffad9 100644 --- a/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java +++ b/src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentStatusSummary.java @@ -83,8 +83,7 @@ private int getPendingPaymentsNumber() throws Exception { for (BasePayment payment : payments) { if (payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS)) || payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ENTERED_INTO_PAYMENT_SYSTEM_PAYMENT_STATUS)) || - payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ACCRUING_PAYMENT_STATUS)) || - payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ON_HOLD_PAYMENT_STATUS))) { + payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ACCRUING_PAYMENT_STATUS))) { paymentPendings.add(payment); } } From 6318121e051c2047b9c02b46c7bcd2922b025dbe Mon Sep 17 00:00:00 2001 From: lunarkid <4476442+dedywahyudi@users.noreply.github.com> Date: Sun, 21 Aug 2022 12:50:10 +0700 Subject: [PATCH 95/95] fix: less than $25 message --- .../web/tc/view/pacts/client/PaymentHistory.jsp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp index 203229903b0..c0c76a03b50 100755 --- a/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp +++ b/src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp @@ -144,10 +144,12 @@ $('.payable:checked').each(function () { hasSelected = true; }); - if (hasSelected) { - $('#payMe').prop("disabled", false); - } else { - $('#payMe').prop("disabled", true); + $('.bigRed').prev().remove(); + $('.bigRed').remove(); + var total = calcTotalPayment() + if (hasSelected && total < 25) { + error = $('').attr('class', 'bigRed').html('The total net amount for selected payments is less than $25'); + $("#PaymentHistoryForm").prev().append('
    ').append(error) } }); });