diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..7413f970fb6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.iml
+*.ipr
+*.iws
diff --git a/build_data_loader.xml b/build_data_loader.xml
index 7a4597eac00..887ff9bc3e2 100644
--- a/build_data_loader.xml
+++ b/build_data_loader.xml
@@ -82,7 +82,10 @@
excludes="${packagedir}/**/SiteCrawler.java,${packagedir}/dwload/cloudspokes/**/*.java,${packagedir}/**/ProcessJiraPayments.java"
debug="true"
nowarn="true"
- verbose="${verbose}">
+ verbose="${verbose}"
+ source="1.5"
+ target="1.5"
+ >
diff --git a/lib/jars/tcs/command_line_utility/1.0.0/command_line_utility.jar b/lib/jars/tcs/command_line_utility/1.0.0/command_line_utility.jar
new file mode 100755
index 00000000000..ec371d5ad6d
Binary files /dev/null and b/lib/jars/tcs/command_line_utility/1.0.0/command_line_utility.jar differ
diff --git a/lib/jars/tcs/reliability_calculator/1.0.4/reliability_calculator.jar b/lib/jars/tcs/reliability_calculator/1.0.4/reliability_calculator.jar
new file mode 100755
index 00000000000..af87e73afdb
Binary files /dev/null and b/lib/jars/tcs/reliability_calculator/1.0.4/reliability_calculator.jar differ
diff --git a/scripts/dde/DWLoad.sh b/scripts/dde/DWLoad.sh
index 602649bb4cc..a2ce0a03609 100755
--- a/scripts/dde/DWLoad.sh
+++ b/scripts/dde/DWLoad.sh
@@ -1,4 +1,11 @@
#!/bin/sh
-CP=../conf:../build/classes:../jars/configmanager_xerces-1.4.4.jar:../jars/tcsUtil.jar:$CLASSPATH
-
-java -cp $CP com.topcoder.dde.util.DWLoad.DWLoad $1
+BASE=../..
+CP=""
+CP=$CP:$BASE/resources
+CP=$CP:$BASE/lib/jars/log4j-1.2.7.jar
+CP=$CP:$BASE/lib/jars/ifxjdbc.jar
+CP=$CP:$BASE/lib/jars/tcs/shared.jar
+CP=$CP:$BASE/build/classes
+CP=$CP:$BASE/build/tcs_dw_loader.jar
+echo $CP
+java -cp $CP com.topcoder.shared.util.dwload.TCLoadUtility -xmlfile $1
diff --git a/scripts/dde/DWLoad.xml b/scripts/dde/DWLoad.xml
index b7555039599..31f819a8d2f 100755
--- a/scripts/dde/DWLoad.xml
+++ b/scripts/dde/DWLoad.xml
@@ -2,4 +2,10 @@
jdbc:informix-sqli://192.168.14.51:2020/tcs_catalog:INFORMIXSERVER=informixoltp_tcp;user=coder;password=xxx
jdbc:informix-sqli://192.168.14.52:2022/tcs_dw:INFORMIXSERVER=datawarehouse_tcp;user=coder;password=xxx
+
+ com.topcoder.utilities.dwload.TCLoadTCS
+
+
+
+
diff --git a/scripts/dde/RatingQubits.xml b/scripts/dde/RatingQubits.xml
index 2d1a48df26a..19a502c3476 100755
--- a/scripts/dde/RatingQubits.xml
+++ b/scripts/dde/RatingQubits.xml
@@ -9,4 +9,12 @@
300
+
+ 150
+ 149
+
+
+ 06/01/2010 06:06:06
+ NULL
+
diff --git a/scripts/dde/ReliabilityCalculationUtility.properties b/scripts/dde/ReliabilityCalculationUtility.properties
new file mode 100755
index 00000000000..b4eda12449e
--- /dev/null
+++ b/scripts/dde/ReliabilityCalculationUtility.properties
@@ -0,0 +1 @@
+com.topcoder.reliability.ReliabilityCalculationUtility=ReliabilityCalculationUtility.xml
diff --git a/scripts/dde/ReliabilityCalculationUtility.xml b/scripts/dde/ReliabilityCalculationUtility.xml
new file mode 100755
index 00000000000..b62eca82dbb
--- /dev/null
+++ b/scripts/dde/ReliabilityCalculationUtility.xml
@@ -0,0 +1,191 @@
+
+
+
+
+ myLogger
+
+
+
+
+ com.topcoder.reliability.impl.ReliabilityCalculatorImpl
+
+
+
+
+
+
+ 1
+ 2
+ 6
+ 7
+ 13
+ 14
+ 19
+ 23
+ 24
+ 26
+ 39
+
+
+ ReliabilityCalculatorImpl
+
+
+
+ 1
+ 2
+ 7
+
+
+ myLogger
+
+
+
+
+ com.topcoder.reliability.impl.persistence.DatabaseReliabilityDataPersistence
+
+
+
+
+ com.topcoder.reliability.impl.comparators.UserProjectParticipationDataResolutionDateBasedComparator
+
+
+
+
+ com.topcoder.reliability.impl.calculators.UniformUserReliabilityCalculator
+
+
+
+
+ com.topcoder.reliability.impl.calculators.WeightedUserReliabilityCalculator
+
+
+
+
+ com.topcoder.reliability.impl.detectors.PhaseEndTimeBasedResolutionDateDetector
+
+
+
+
+ DatabaseReliabilityDataPersistence
+
+
+
+
+ myLogger
+
+
+
+
+
+ myConnection
+
+
+
+ com.topcoder.db.connectionfactory.producers.JDBCConnectionProducer
+
+
+
+ com.informix.jdbc.IfxDriver
+
+
+ jdbc:informix-sqli://env.topcoder.com:2021/tcs_catalog:INFORMIXSERVER=informixoltp_tcp
+
+
+ cursor
+
+
+ informix
+
+
+ 1nf0rm1x
+
+
+
+
+
+
+
+ myConnection
+
+
+
+ UserProjectParticipationDataResolutionDateBasedComparator
+
+
+
+ 1
+ 2
+ 3
+ 39
+
+
+ 2005-10-05 09:00
+
+
+ UniformUserReliabilityCalculator
+
+
+
+ myLogger
+
+
+ 15
+
+
+
+ PhaseEndTimeBasedResolutionDateDetector
+
+
+
+ myLogger
+
+
+
+
+
+ 6
+ 7
+ 13
+ 14
+ 19
+ 23
+ 24
+ 26
+ 39
+
+
+ 2009-03-23 00:00
+
+
+ WeightedUserReliabilityCalculator
+
+
+
+ myLogger
+
+
+ 0.82
+ 0.84
+ 0.86
+ 0.88
+ 0.9
+ 0.92
+ 0.94
+ 0.96
+ 0.98
+ 1.00
+
+
+
+ PhaseEndTimeBasedResolutionDateDetector
+
+
+
+ myLogger
+
+
+
+
+
+
+
diff --git a/scripts/dde/runRatings.sh b/scripts/dde/runRatings.sh
index 19798a5b5f9..79c12b5e2e4 100755
--- a/scripts/dde/runRatings.sh
+++ b/scripts/dde/runRatings.sh
@@ -1,15 +1,17 @@
BASE=../..
+mkdir -p $BASE/resources/com/topcoder/dde/util/DWLoad
+cp -f RatingQubits.xml $BASE/resources/com/topcoder/dde/util/DWLoad
CP=""
-CP=$CP:$BASE/conf
CP=$CP:$BASE/resources
CP=$CP:$BASE/lib/jars/log4j.jar
CP=$CP:$BASE/lib/jars/ifxjdbc.jar
CP=$CP:$BASE/lib/jars/jdbc7.0-1.2.jar
CP=$CP:$BASE/lib/jars/xml/xerces/xercesImpl.jar
CP=$CP:$BASE/build/classes
+CP=$CP:$BASE/lib/jars/tcs/shared.jar
+CP=$CP:$BASE/lib/jars/log4j-1.2.7.jar
CP=$CP:$BASE/lib/jars/tcsUtil.jar
CP=$CP:$BASE/lib/jars/configmanager2.jar
CP=$CP:$BASE/lib/jars/jboss/xercesImpl.jar
CP=$CP:$BASE/lib/jars/jboss/xml-apis.jar
-
-nohup java -cp $CP com.topcoder.dde.util.DWLoad.RatingQubits >> ./ratings.log 2>&1 &
+nohup java -cp $CP com.topcoder.dde.util.DWLoad.RatingQubits > ./ratings.log 2>&1 &
diff --git a/scripts/dde/runReliability.sh b/scripts/dde/runReliability.sh
index 64e432c309b..bdc96c8cb4d 100755
--- a/scripts/dde/runReliability.sh
+++ b/scripts/dde/runReliability.sh
@@ -1,16 +1,19 @@
#!/bin/sh
-CP=$CP:/home/tc/web/conf
-CP=$CP:/home/tc/web/build/classes
-CP=$CP:/home/tc/web/lib/jars/log4j-1.2.7.jar
-CP=$CP:/home/tc/web/lib/jars/ifxjdbc.jar
-CP=$CP:/home/tc/web/lib/jars/tcs/configuration_manager/2.1.3/configuration_manager.jar
-CP=$CP:/home/tc/web/lib/jars/tcsUtil.jar:
-CP=$CP:/home/tc/web/lib/jars/jboss/xml-apis.jar:
-CP=$CP:/home/tc/web/lib/jars/jboss/xalan.jar:
-CP=$CP:/home/tc/web/lib/jars/jboss/xercesImpl.jar:
-CP=$CP:/home/tc/jboss-4.0.4.GA/server/all/lib/shared.jar
-CP=$CP:/home/tc/jboss-4.0.4.GA/client/jbossall-client.jar
-CP=$CP:/home/tc/jboss-4.0.4.GA/server/all/conf/cache.properties
-echo $CP
+BASE=../..
+CP=$CP:$BASE/resources
+CP=$CP:$BASE/lib/jars/log4j-1.2.7.jar
+CP=$CP:$BASE/lib/jars/ifxjdbc.jar
+CP=$CP:$BASE/lib/jars/tcs/base_exception/2.0.0/base_exception.jar
+CP=$CP:$BASE/lib/jars/tcs/configuration_api/1.1.0/configuration_api.jar
+CP=$CP:$BASE/lib/jars/tcs/configuration_persistence/1.0.2/configuration_persistence.jar
+CP=$CP:$BASE/lib/jars/tcs/logging_wrapper.jar
+CP=$CP:$BASE/lib/jars/tcs/command_line_utility/1.0.0/command_line_utility.jar
+CP=$CP:$BASE/lib/jars/tcs/db_connection_factory/1.1/db_connection_factory.jar
+CP=$CP:$BASE/lib/jars/tcs/object_factory/2.0/object_factory.jar
+CP=$CP:$BASE/lib/jars/tcs/object_factory_configuration_api_plugin/1.0.0/object_factory_configuration_api_plugin.jar
+CP=$CP:$BASE/lib/jars/tcs/object_formatter/1.0.0/object_formatter.jar
+CP=$CP:$BASE/lib/jars/tcs/typesafe_enum/1.0/typesafe_enum.jar
+CP=$CP:$BASE/lib/jars/tcs/configuration_manager/2.1.5/configuration_manager.jar
+CP=$CP:$BASE/lib/jars/tcs/reliability_calculator/1.0.4/reliability_calculator.jar
-java -cp $CP com.topcoder.dde.util.DWLoad.ReliabilityRating
\ No newline at end of file
+java -cp $CP com.topcoder.reliability.ReliabilityCalculationUtility -c ReliabilityCalculationUtility.properties
diff --git a/src/main/com/topcoder/dde/util/DWLoad/RatingQubits.java b/src/main/com/topcoder/dde/util/DWLoad/RatingQubits.java
index 14135147452..c96bed01679 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):
+ *
+ * - Added support for code challenge and load phase ids, cutoffs configurations from file.
+ *
+ *
+ *
+ * @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,6 +100,12 @@ 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)";
/**
@@ -88,6 +126,11 @@ public class RatingQubits {
" 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')) ";
+ /**
+ * 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;
@@ -231,7 +338,6 @@ private void runScore(Connection conn, String historyLength, int phase, Date cut
"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) {
diff --git a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java
index 6c4629eb4f6..939b4724397 100755
--- a/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java
+++ b/src/main/com/topcoder/utilities/dwload/TCLoadTCS.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 - 2015 TopCoder Inc., All Rights Reserved.
+ * Copyright (C) 2004 - 2018 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.utilities.dwload;
@@ -197,8 +197,12 @@
* Update {#link #doLoadProjectResults} to load the correct results for First2Finish
*
*
- * @author rfairfax, pulky, ivern, VolodymyrK, moonli, isv, minhu, Blues, Veve, Veve
- * @version 1.4.3
+ *
+ * Version 1.4.4 (Topcoder - Support Rating and Reliability Generation For Code Challenges in DWLoad)
+ *
add support for user rating of code challenge
+ *
+ * @author rfairfax, pulky, ivern, VolodymyrK, moonli, isv, minhu, Blues, Veve, Veve,TCCODER
+ * @version 1.4.4
*/
public class TCLoadTCS extends TCLoad {
@@ -211,8 +215,9 @@ public class TCLoadTCS extends TCLoad {
/**
* An int
array representing all project categories that are currently being rated.
* IF YOU CHANGE THIS LIST, YOU MUST ALSO UPDATE THE getCurrentRatings
METHOD!
+ * @since 1.4.4
*/
- private static final int[] RATED_CATEGORIES = new int[] {1, 2, 6, 7, 13, 14, 23, 26, 19, 24, 35, 36};
+ private static final int[] RATED_CATEGORIES = new int[] {1, 2, 6, 7, 13, 14, 23, 26, 19, 24, 35, 36, 39};
/**
* The DR percentage table of the studio contests.
@@ -1838,7 +1843,6 @@ public void doLoadProjects() throws Exception {
" AND MONTH(project.posting_date) = c.month_numeric " +
" AND DAY(project.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);
select.setTimestamp(1, fLastLogTime);
select.setTimestamp(2, fLastLogTime);
@@ -4827,6 +4831,7 @@ public void doLoadUserEvent() throws Exception {
*
* @return List containing CoderRating objects
* @throws Exception if something goes wrong when querying
+ * @since 1.4.4
*/
private List getCurrentRatings() throws Exception {
StringBuffer query;
@@ -4877,6 +4882,10 @@ private List getCurrentRatings() throws Exception {
query.append(" , case");
query.append(" when ur.phase_id = 147 and exists (select '1' from active_reporting_competitors arep where arep.user_id = ur.user_id)");
query.append(" then 1 else 0 end as active_rep");
+ query.append(" , case");
+ // use raw sql instead of view here
+ query.append(" when ur.phase_id = 150 and exists (select '1' from user_rating x0,project x1 where x0.last_rated_project_id = x1.project_id and x1.phase_id = x0.phase_id and x0.phase_id = 150 and x1.posting_date > (CURRENT YEAR TO fraction(3) - interval( 180) DAY(9) TO DAY) and x0.user_id = ur.user_id)");
+ query.append(" then 1 else 0 end as active_code");
query.append(" , cs.school_id");
query.append(" , c.coder_type_id");
query.append(" , c.comp_country_code");
@@ -4886,7 +4895,6 @@ private List getCurrentRatings() throws Exception {
query.append(" where ur.user_id = cs.coder_id");
query.append(" and ur.user_id = c.coder_id");
query.append(" and c.status = 'A'");
-
psSel = prepareStatement(query.toString(), TARGET_DB);
rs = psSel.executeQuery();
@@ -4930,6 +4938,9 @@ private List getCurrentRatings() throws Exception {
} else if (rs.getInt("phase_id") == 147) {
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"),
rs.getInt("active_rep") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
+ } else if (rs.getInt("phase_id") == 150) {
+ ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"),
+ rs.getInt("active_code") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
}
} else {
//students
@@ -4969,6 +4980,9 @@ private List getCurrentRatings() throws Exception {
} else if (rs.getInt("phase_id") == 147) {
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"), rs.getLong("school_id"),
rs.getInt("active_rep") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
+ } else if (rs.getInt("phase_id") == 150) {
+ ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"), rs.getLong("school_id"),
+ rs.getInt("active_code") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
}
}
}
diff --git a/src/main/com/topcoder/utilities/pacts/PayReliabilityBonus.java b/src/main/com/topcoder/utilities/pacts/PayReliabilityBonus.java
index 00d038c8d97..668e83564ba 100644
--- a/src/main/com/topcoder/utilities/pacts/PayReliabilityBonus.java
+++ b/src/main/com/topcoder/utilities/pacts/PayReliabilityBonus.java
@@ -1,3 +1,6 @@
+/*
+ * Copyright (C) 2004 - 2018 TopCoder Inc., All Rights Reserved.
+ */
package com.topcoder.utilities.pacts;
@@ -18,10 +21,15 @@
/**
* Checks the component payments that don't have reliability bonus payment and create their payments.
- *
- *
- * @author cucu, DixonD
- * @version 1.0
+ *
+ *
+ * Version 1.1 Change notes(Topcoder - Support Rating and Reliability Generation For Code Challenges in DWLoad):
+ *
+ * - Added support for code challenge.
+ *
+ *
+ * @author cucu, DixonD,TCCODER
+ * @version 1.1
*/
public class PayReliabilityBonus extends DBUtility {
@@ -30,6 +38,11 @@ public class PayReliabilityBonus extends DBUtility {
*/
private String onlyAnalyze = null;
+ /**
+ * Run utility.
+ * @throws Exception throws if error happens
+ * @ since 1.1
+ */
protected void runUtility() throws Exception {
PactsClientServices ejb = (PactsClientServices) createEJB();
@@ -60,7 +73,7 @@ protected void runUtility() throws Exception {
query.append("AND pr.project_id = pro.project_id ");
query.append("AND reliability_on_registration >= 0.8 ");
query.append("AND pd.payment_type_id = " + PactsConstants.CONTEST_PAYMENT + " ");
- query.append("AND pro.project_category_id in (1, 2, 6, 7, 13, 14, 19, 23, 24, 26, 35, 36) ");
+ query.append("AND pro.project_category_id in (1, 2, 6, 7, 13, 14, 19, 23, 24, 26, 35, 36,39) ");
query.append("AND pro.project_id not in (select project_id from tcs_catalog:project_info where project_info_type_id=45 and (value='false' or value='False')) ");
// The following line is not to pay the old projects posted before we did the change to the reliability calculation logic on Dec 2010