Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 89f92f8

Browse files
committed
Added rating and reliability for the Content Creation and Reporting tracks.
1 parent cc21573 commit 89f92f8

File tree

23 files changed

+596
-58
lines changed

23 files changed

+596
-58
lines changed

resources/TC.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ min_ui_prototype_rating = minuira
400400
max_ui_prototype_rating = maxuira
401401
min_ria_build_rating = minriara
402402
max_ria_build_rating = maxriara
403+
min_content_creation_rating = minccra
404+
max_content_creation_rating = maxccra
405+
min_reporting_rating = minrepra
406+
max_reporting_rating = maxrepra
403407
min_num_ratings = nrn
404408
max_num_ratings = mrn
405409
max_days_since_last_comp = mdslc

scripts/tc/coder_data.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ SELECT c.handle
7878
WHERE c.coder_id = @cr@
7979
AND c.coder_id = r.user_id
8080
AND r.phase_id = 135) AS ria_build_rating
81+
, (SELECT r.rating
82+
FROM coder c
83+
, OUTER tcs_dw:user_rating r
84+
WHERE c.coder_id = @cr@
85+
AND c.coder_id = r.user_id
86+
AND r.phase_id = 146) AS content_creation_rating
87+
, (SELECT r.rating
88+
FROM coder c
89+
, OUTER tcs_dw:user_rating r
90+
WHERE c.coder_id = @cr@
91+
AND c.coder_id = r.user_id
92+
AND r.phase_id = 147) AS reporting_rating
8193
, 0 AS development_earnings
8294
, cr.rank
8395
, cr.percentile

src/main/com/topcoder/dde/util/DWLoad/RatingQubits.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public class RatingQubits {
6666
private static final int TEST_SCENARIOS_PHASE_ID = 137;
6767
private static final int UI_PROTOTYPES_PHASE_ID = 130;
6868
private static final int RIA_BUILDS_PHASE_ID = 135;
69-
private final static String NEW_RATING_CATEGORIES = "(4, 7, 8)";
69+
private static final int CONTENT_CREATION_PHASE_ID = 146;
70+
private static final int REPORTING_PHASE_ID = 147;
71+
private final static String NEW_RATING_STATUSES = "(4, 7, 8)";
7072

7173
/**
7274
* SQL fragment to be added to a where clause to not select projects with eligibility constraints
@@ -185,6 +187,8 @@ public void runAllScores(Connection conn, String historyLength) {
185187
runScore(conn, historyLength, TEST_SCENARIOS_PHASE_ID, newPhasesCutoff);
186188
runScore(conn, historyLength, UI_PROTOTYPES_PHASE_ID, uiPrototypeCutoff);
187189
runScore(conn, historyLength, RIA_BUILDS_PHASE_ID, riaBuildCutoff);
190+
runScore(conn, historyLength, CONTENT_CREATION_PHASE_ID, riaBuildCutoff);
191+
runScore(conn, historyLength, REPORTING_PHASE_ID, riaBuildCutoff);
188192
}
189193

190194
// Run a score without a specific cut off time
@@ -215,7 +219,7 @@ private void runScore(Connection conn, String historyLength, int phase, Date cut
215219
sqlStr += ", project_phase pp ";
216220
}
217221
sqlStr += "where p.project_id = pr.project_id " +
218-
"and p.project_status_id in " + NEW_RATING_CATEGORIES + " " +
222+
"and p.project_status_id in " + NEW_RATING_STATUSES + " " +
219223
"and p.project_category_id = ? " +
220224
"and pr.rating_ind = 1 " +
221225
"and pr.final_score is not null " +
@@ -586,7 +590,7 @@ private void rateProjects(Connection conn, ResultSet rs, int phaseId, String his
586590
*/
587591
private final String OLD_RATINGS = "select pr.project_id, pr.user_id, pr.old_rating from project_result pr, project p " +
588592
"where p.project_id = pr.project_id " +
589-
"and p.project_status_id in " + NEW_RATING_CATEGORIES + " " +
593+
"and p.project_status_id in " + NEW_RATING_STATUSES + " " +
590594
"and p.project_category_id = ? " +
591595
"and pr.rating_ind =1 " +
592596
ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT +
@@ -624,7 +628,7 @@ private HashMap<String, Integer> getOldRatingsMap(Connection conn, int categoryI
624628
*/
625629
private final String NEW_RATINGS = "select pr.project_id, pr.user_id, pr.new_rating from project_result pr, project p " +
626630
"where p.project_id = pr.project_id " +
627-
"and p.project_status_id in " + NEW_RATING_CATEGORIES + " " +
631+
"and p.project_status_id in " + NEW_RATING_STATUSES + " " +
628632
"and p.project_category_id = ? " +
629633
"and pr.rating_ind =1 " +
630634
ELIGIBILITY_CONSTRAINTS_SQL_FRAGMENT +

src/main/com/topcoder/utilities/dwload/TCLoadTCS.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ public class TCLoadTCS extends TCLoad {
120120
* <p>A <code>String</code> representing all those project categories than should be loaded to the
121121
* data warehouse.</p>
122122
*/
123-
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 )";
123+
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 )";
124124

125125
/**
126126
* <p>An <code>int</code> array representing all project categories that are currently being rated.
127127
* IF YOU CHANGE THIS LIST, YOU MUST ALSO UPDATE THE <code>getCurrentRatings</code> METHOD!</p>
128128
*/
129-
private static final int[] RATED_CATEGORIES = new int[] {1, 2, 6, 7, 13, 14, 23, 26, 19, 24};
129+
private static final int[] RATED_CATEGORIES = new int[] {1, 2, 6, 7, 13, 14, 23, 26, 19, 24, 35, 36};
130130

131131
/**
132132
* <p>We have too many projects to fit in a single IN statement in a retrieval query any more, so we'll split the
@@ -2907,7 +2907,6 @@ private List<CoderRating> getCurrentRatings() throws Exception {
29072907

29082908
query = new StringBuffer(100);
29092909

2910-
29112910
query.append(" select ur.user_id");
29122911
query.append(" , ur.rating");
29132912
query.append(" , ur.phase_id");
@@ -2941,6 +2940,12 @@ private List<CoderRating> getCurrentRatings() throws Exception {
29412940
query.append(" , case");
29422941
query.append(" when ur.phase_id = 135 and exists (select '1' from active_ria_builds_competitors arbu where arbu.user_id = ur.user_id)");
29432942
query.append(" then 1 else 0 end as active_rbu");
2943+
query.append(" , case");
2944+
query.append(" when ur.phase_id = 146 and exists (select '1' from active_content_creation_competitors acc where acc.user_id = ur.user_id)");
2945+
query.append(" then 1 else 0 end as active_cc");
2946+
query.append(" , case");
2947+
query.append(" when ur.phase_id = 147 and exists (select '1' from active_reporting_competitors arep where arep.user_id = ur.user_id)");
2948+
query.append(" then 1 else 0 end as active_rep");
29442949
query.append(" , cs.school_id");
29452950
query.append(" , c.coder_type_id");
29462951
query.append(" , c.comp_country_code");
@@ -2988,6 +2993,12 @@ private List<CoderRating> getCurrentRatings() throws Exception {
29882993
} else if (rs.getInt("phase_id") == 135) {
29892994
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"),
29902995
rs.getInt("active_rbu") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
2996+
} else if (rs.getInt("phase_id") == 146) {
2997+
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"),
2998+
rs.getInt("active_cc") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
2999+
} else if (rs.getInt("phase_id") == 147) {
3000+
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"),
3001+
rs.getInt("active_rep") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
29913002
}
29923003
} else {
29933004
//students
@@ -3021,6 +3032,12 @@ private List<CoderRating> getCurrentRatings() throws Exception {
30213032
} else if (rs.getInt("phase_id") == 135) {
30223033
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"), rs.getLong("school_id"),
30233034
rs.getInt("active_rbu") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
3035+
} else if (rs.getInt("phase_id") == 146) {
3036+
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"), rs.getLong("school_id"),
3037+
rs.getInt("active_cc") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
3038+
} else if (rs.getInt("phase_id") == 147) {
3039+
ret.add(new CoderRating(rs.getLong("user_id"), rs.getInt("rating"), rs.getLong("school_id"),
3040+
rs.getInt("active_rep") == 1, rs.getInt("phase_id"), rs.getString("comp_country_code")));
30243041
}
30253042
}
30263043
}

src/main/com/topcoder/utilities/pacts/PayReliabilityBonus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected void runUtility() throws Exception {
6060
query.append("AND pr.project_id = pro.project_id ");
6161
query.append("AND reliability_on_registration >= 0.8 ");
6262
query.append("AND pd.payment_type_id = " + PactsConstants.CONTEST_PAYMENT + " ");
63-
query.append("AND pro.project_category_id in (1, 2, 6, 7, 13, 14, 19, 23, 24, 26, 35) ");
63+
query.append("AND pro.project_category_id in (1, 2, 6, 7, 13, 14, 19, 23, 24, 26, 35, 36) ");
6464
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')) ");
6565

6666
// The following line is not to pay the old projects posted before we did the change to the reliability calculation logic on Dec 2010

src/main/com/topcoder/web/common/tag/HandleTag.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public class HandleTag extends TagSupport {
4242
public final static String TEST_SCENARIOS = "test_scenarios";
4343
public final static String UI_PROTOTYPE = "ui_prototype";
4444
public final static String RIA_BUILD = "ria_build";
45+
public final static String CONTENT_CREATION = "content_creation";
46+
public final static String REPORTING = "reporting";
4547
public final static String COMPONENT = "component";
4648
public final static String HS_OR_ALGORITHM = "hs_or_algorithm";
4749
public final static String MARATHON_MATCH = "marathon_match";
@@ -176,6 +178,10 @@ public static String getLink(long coderId, String cssclass, String link,
176178
output.append("&amp;tab=ui_prototype");
177179
} else if (context.trim().equalsIgnoreCase(RIA_BUILD) && rsc.getIntItem(0, "ria_build_rating") > 0) {
178180
output.append("&amp;tab=ria_build");
181+
} else if (context.trim().equalsIgnoreCase(CONTENT_CREATION) && rsc.getIntItem(0, "content_creation_rating") > 0) {
182+
output.append("&amp;tab=content_creation");
183+
} else if (context.trim().equalsIgnoreCase(REPORTING) && rsc.getIntItem(0, "reporting_rating") > 0) {
184+
output.append("&amp;tab=reporting");
179185
} else if (context.trim().equalsIgnoreCase(COMPONENT)) {
180186
if (rsc.getIntItem(0, "design_rating") >= rsc.getIntItem(0, "development_rating")) {
181187
if (rsc.getIntItem(0, "design_rating") > 0) {
@@ -221,7 +227,9 @@ public static String getLink(long coderId, String cssclass, String link,
221227
rsc.getIntItem(0, "test_suites_rating"),
222228
rsc.getIntItem(0, "test_scenarios_rating"),
223229
rsc.getIntItem(0, "ui_prototype_rating"),
224-
rsc.getIntItem(0, "ria_build_rating"));
230+
rsc.getIntItem(0, "ria_build_rating"),
231+
rsc.getIntItem(0, "content_creation_rating"),
232+
rsc.getIntItem(0, "reporting_rating"));
225233
} else if (context.trim().equalsIgnoreCase(ALGORITHM)) {
226234
rating = rsc.getIntItem(0, "algorithm_rating");
227235
} else if (context.trim().equalsIgnoreCase(HS_ALGORITHM)) {
@@ -248,6 +256,10 @@ public static String getLink(long coderId, String cssclass, String link,
248256
rating = rsc.getIntItem(0, "ui_prototype_rating");
249257
} else if (context.trim().equalsIgnoreCase(RIA_BUILD)) {
250258
rating = rsc.getIntItem(0, "ria_build_rating");
259+
} else if (context.trim().equalsIgnoreCase(CONTENT_CREATION)) {
260+
rating = rsc.getIntItem(0, "content_creation_rating");
261+
} else if (context.trim().equalsIgnoreCase(REPORTING)) {
262+
rating = rsc.getIntItem(0, "reporting_rating");
251263
} else if (context.trim().equalsIgnoreCase(COMPONENT)) {
252264
rating = max(rsc.getIntItem(0, "design_rating"),
253265
rsc.getIntItem(0, "development_rating"));
@@ -267,7 +279,9 @@ public static String getLink(long coderId, String cssclass, String link,
267279
rsc.getIntItem(0, "test_suites_rating"),
268280
rsc.getIntItem(0, "test_scenarios_rating"),
269281
rsc.getIntItem(0, "ui_prototype_rating"),
270-
rsc.getIntItem(0, "ria_build_rating"));
282+
rsc.getIntItem(0, "ria_build_rating"),
283+
rsc.getIntItem(0, "content_creation_rating"),
284+
rsc.getIntItem(0, "reporting_rating"));
271285
}
272286
}
273287

@@ -302,8 +316,8 @@ else if (rating > 1499 && rating < 2200)
302316
}
303317

304318

305-
private static int max(int a, int b, int c, int d, int e, int i, int j, int k, int l, int m, int n, int o, int p) {
306-
return max(max(max(max(max(max(max(max(max(max(max(max(a, b), c), d), e), i), j), k), l), m), n), o), p);
319+
private static int max(int a, int b, int c, int d, int e, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r) {
320+
return max(max(max(max(max(max(max(max(max(max(max(max(max(max(a, b), c), d), e), i), j), k), l), m), n), o), p), q), r);
307321
}
308322

309323
private static int max(int a, int b) {

src/main/com/topcoder/web/tc/Constants.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,12 @@ public class Constants implements WebConstants {
538538
*
539539
* @since 1.9
540540
*/
541-
public static String MAX_RIA_BUILD_RATING;
541+
public static String MAX_RIA_BUILD_RATING;
542+
543+
public static String MIN_CONTENT_CREATION_RATING;
544+
public static String MAX_CONTENT_CREATION_RATING;
545+
public static String MIN_REPORTING_RATING;
546+
public static String MAX_REPORTING_RATING;
542547

543548
/**
544549
* <p>A <code>String</code> providing the namespace of terms of use DAO implementation.</p>

src/main/com/topcoder/web/tc/controller/request/compstats/CompetitionHistory.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ protected void businessProcessing() throws Exception {
7777
!getRequest().getParameter(Constants.PHASE_ID).equals(String.valueOf(SoftwareComponent.TEST_SUITES_PHASE)) &&
7878
!getRequest().getParameter(Constants.PHASE_ID).equals(String.valueOf(SoftwareComponent.TEST_SCENARIOS_PHASE)) &&
7979
!getRequest().getParameter(Constants.PHASE_ID).equals(String.valueOf(SoftwareComponent.UI_PROTOTYPE_PHASE)) &&
80-
!getRequest().getParameter(Constants.PHASE_ID).equals(String.valueOf(SoftwareComponent.RIA_BUILD_PHASE))) {
80+
!getRequest().getParameter(Constants.PHASE_ID).equals(String.valueOf(SoftwareComponent.RIA_BUILD_PHASE)) &&
81+
!getRequest().getParameter(Constants.PHASE_ID).equals(String.valueOf(SoftwareComponent.CONTENT_CREATION_PHASE)) &&
82+
!getRequest().getParameter(Constants.PHASE_ID).equals(String.valueOf(SoftwareComponent.REPORTING_PHASE))) {
8183
throw new TCWebException("invalid " + Constants.PHASE_ID + " parameter.");
8284
}
8385

@@ -91,7 +93,9 @@ protected void businessProcessing() throws Exception {
9193
!getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(String.valueOf(Constants.TEST_SUITES_PROJECT_TYPE)) &&
9294
!getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(String.valueOf(Constants.TEST_SCENARIOS_PROJECT_TYPE)) &&
9395
!getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(String.valueOf(Constants.UI_PROTOTYPE_PROJECT_TYPE)) &&
94-
!getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(String.valueOf(Constants.RIA_BUILD_PROJECT_TYPE))) {
96+
!getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(String.valueOf(Constants.RIA_BUILD_PROJECT_TYPE)) &&
97+
!getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(String.valueOf(Constants.CONTENT_CREATION_PROJECT_TYPE)) &&
98+
!getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(String.valueOf(Constants.REPORTING_PROJECT_TYPE))) {
9599
throw new TCWebException("invalid " + Constants.PROJECT_TYPE_ID + " parameter.");
96100
}
97101

@@ -194,7 +198,13 @@ protected void businessProcessing() throws Exception {
194198
break;
195199
case Constants.RIA_BUILD_PROJECT_TYPE:
196200
handleType = HandleTag.RIA_BUILD;
197-
break;
201+
break;
202+
case Constants.CONTENT_CREATION_PROJECT_TYPE:
203+
handleType = HandleTag.CONTENT_CREATION;
204+
break;
205+
case Constants.REPORTING_PROJECT_TYPE:
206+
handleType = HandleTag.REPORTING;
207+
break;
198208
}
199209
getRequest().setAttribute(Constants.TYPE_KEY, handleType);
200210

src/main/com/topcoder/web/tc/controller/request/compstats/OutstandingProjects.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ protected void businessProcessing() throws Exception {
8181
&& !getRequest().getParameter(Constants.PHASE_ID).equals(
8282
String.valueOf(SoftwareComponent.UI_PROTOTYPE_PHASE))
8383
&& !getRequest().getParameter(Constants.PHASE_ID).equals(
84-
String.valueOf(SoftwareComponent.RIA_BUILD_PHASE))) {
84+
String.valueOf(SoftwareComponent.RIA_BUILD_PHASE))
85+
&& !getRequest().getParameter(Constants.PHASE_ID).equals(
86+
String.valueOf(SoftwareComponent.CONTENT_CREATION_PHASE))
87+
&& !getRequest().getParameter(Constants.PHASE_ID).equals(
88+
String.valueOf(SoftwareComponent.REPORTING_PHASE))) {
8589
throw new TCWebException("invalid " + Constants.PHASE_ID + " parameter.");
8690
}
8791

@@ -105,7 +109,11 @@ protected void businessProcessing() throws Exception {
105109
&& !getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(
106110
String.valueOf(Constants.UI_PROTOTYPE_PROJECT_TYPE))
107111
&& !getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(
108-
String.valueOf(Constants.RIA_BUILD_PROJECT_TYPE))) {
112+
String.valueOf(Constants.RIA_BUILD_PROJECT_TYPE))
113+
&& !getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(
114+
String.valueOf(Constants.CONTENT_CREATION_PROJECT_TYPE))
115+
&& !getRequest().getParameter(Constants.PROJECT_TYPE_ID).equals(
116+
String.valueOf(Constants.REPORTING_PROJECT_TYPE))) {
109117
throw new TCWebException("invalid " + Constants.PROJECT_TYPE_ID + " parameter.");
110118
}
111119

@@ -196,7 +204,13 @@ protected void businessProcessing() throws Exception {
196204
break;
197205
case Constants.RIA_BUILD_PROJECT_TYPE:
198206
handleType = HandleTag.RIA_BUILD;
199-
break;
207+
break;
208+
case Constants.CONTENT_CREATION_PROJECT_TYPE:
209+
handleType = HandleTag.CONTENT_CREATION;
210+
break;
211+
case Constants.REPORTING_PROJECT_TYPE:
212+
handleType = HandleTag.REPORTING;
213+
break;
200214
}
201215
getRequest().setAttribute(Constants.TYPE_KEY, handleType);
202216
getRequest().setAttribute(Constants.CODER_ID, getRequest().getParameter(Constants.CODER_ID));

0 commit comments

Comments
 (0)