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

Commit b687498

Browse files
authored
Merge pull request #238 from appirio-tech/dev
Zero prizes, allowed character checking
2 parents f137e98 + 721723e commit b687498

File tree

13 files changed

+107
-43
lines changed

13 files changed

+107
-43
lines changed

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ In this configuration, we'll run the direct app in a docker container locally bu
3232
3333
---
3434

35+
## Test Users
36+
37+
direct_user/topcoder2001 (Use this user to login to Direct and create challenges in the Topcoder DEV environment. You can alsoo use this user to manipulate challenges in Online Review)
3538

3639
## **old** instructions
3740

Diff for: components/project_management/src/java/main/com/topcoder/management/project/ProjectPropertyType.java

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2006 - 2016 TopCoder Inc., All Rights Reserved.
2+
* Copyright (C) 2006 - 2017 TopCoder Inc., All Rights Reserved.
33
*/
44
package com.topcoder.management.project;
55

@@ -44,8 +44,13 @@
4444
* - Add property {@link #PRIVATE_PROJECT}
4545
* </p>
4646
*
47+
* <p>
48+
* Version 1.2.7 (TOPCODER DIRECT - ADD OPTIONAL CHALLENGE PROPERTY - PRODUCT)
49+
* - Add property {@link #PRODUCT_SKU}
50+
* </p>
51+
*
4752
* @author tuenm, iamajia, flytoj2ee, tangzx, GreatKevin, TCSCODER
48-
* @version 1.2.6
53+
* @version 1.2.7
4954
* @since 1.0
5055
*/
5156
public class ProjectPropertyType implements Serializable {
@@ -366,6 +371,13 @@ public class ProjectPropertyType implements Serializable {
366371
*/
367372
public static final String PRIVATE_PROJECT = "Private Project Status";
368373

374+
/**
375+
* Represent "Product SKU" project property type
376+
*
377+
* @since 1.2.7
378+
*/
379+
public static final String PRODUCT_SKU = "Product SKU";
380+
369381
/**
370382
* Represents the id of this instance. Only values greater than zero is
371383
* allowed. This variable is initialized in the constructor and can be

Diff for: docker-compose.yml

-23
This file was deleted.

Diff for: services/project_service/src/java/main/com/topcoder/service/project/impl/ProjectServiceBean.java

-4
Original file line numberDiff line numberDiff line change
@@ -1996,17 +1996,13 @@ private void checkProjectData(ProjectData projectData, boolean isCreate) throws
19961996
throw logException(new IllegalArgumentFault("The name attribute of the project data can not be null."));
19971997
} else if (name.trim().length() == 0) {
19981998
throw logException(new IllegalArgumentFault("The name attribute of the project data can not be empty."));
1999-
} else if (!Pattern.matches(NAME_PATTERN, name)) {
2000-
throw logException(new IllegalArgumentFault("The name attribute of the project data is not following pattern as - " + NAME_PATTERN));
20011999
}
20022000

20032001
String description = projectData.getDescription();
20042002
if (null == description) {
20052003
throw logException(new IllegalArgumentFault("The description attribute of the project data can not be null."));
20062004
} else if (description.trim().length() == 0) {
20072005
throw logException(new IllegalArgumentFault("The description attribute of the project data can not be empty."));
2008-
} else if (!Pattern.matches(NAME_PATTERN, description)) {
2009-
throw logException(new IllegalArgumentFault("The description attribute of the project data is not following pattern as - " + NAME_PATTERN));
20102006
}
20112007

20122008
//added in version 2.2

Diff for: src/java/main/com/topcoder/direct/services/view/action/contest/launch/SaveDraftContestAction.java

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2010 - 2016 TopCoder Inc., All Rights Reserved.
2+
* Copyright (C) 2010 - 2017 TopCoder Inc., All Rights Reserved.
33
*/
44
package com.topcoder.direct.services.view.action.contest.launch;
55

@@ -265,8 +265,16 @@
265265
* <li>Updated {@link #executeAction()}</li>
266266
* </ul>
267267
* </p>
268-
* @author fabrizyo, FireIce, Veve, isv, GreatKevin, flexme, frozenfx, bugbuka, GreatKevin, Veve
269-
* @version 2.3
268+
*
269+
* <p>
270+
* Version 2.4 (TOPCODER DIRECT - SUPPORT CHALLENGES WITH ZERO PRIZE):
271+
* <ul>
272+
* <li>Updated {@link #populateCompetition(SoftwareCompetition)} method to accept zero prize</li>
273+
* </ul>
274+
* </p>
275+
*
276+
* @author fabrizyo, FireIce, Veve, isv, GreatKevin, flexme, frozenfx, bugbuka, TCSCODER
277+
* @version 2.4
270278
*/
271279
public class SaveDraftContestAction extends ContestAction {
272280
/**
@@ -964,7 +972,7 @@ public boolean evaluate(Object object) {
964972
List<Prize> newPrizes = new ArrayList<Prize>();
965973
if (prizes != null) {
966974
for (Prize prize : prizes) {
967-
if (prize.getPrizeAmount() > 0) {
975+
if (prize.getPrizeAmount() >= 0) {
968976
if (projectId > 0) {
969977
prize.setProjectId(projectId);
970978
} else {
@@ -1037,6 +1045,11 @@ public boolean evaluate(Object object) {
10371045
}
10381046
}
10391047
}
1048+
if ((softwareCompetition.getProjectHeader().getProperty(ProjectPropertyType.PRODUCT_SKU) == null ||
1049+
"".equals(softwareCompetition.getProjectHeader().getProperty(ProjectPropertyType.PRODUCT_SKU))) &&
1050+
softwareCompetition.getProjectHeader().getProperties().containsKey(ProjectPropertyType.PRODUCT_SKU)){
1051+
softwareCompetition.getProjectHeader().getProperties().remove(ProjectPropertyType.PRODUCT_SKU);
1052+
}
10401053
}
10411054

10421055
/**

Diff for: src/web/WEB-INF/includes/contest/editTab.jsp

+17-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<td class="first_tab_type"><strong>Billing Account</strong></td>
9797
<td class="sec_tab_type"><strong>: <span id="rBillingAccount"></span></strong></td>
9898
</tr>
99+
<tr></tr>
99100
<%--
100101
<tr>
101102
<td class="first_tab_type"><strong>Private Group</strong></td>
@@ -118,6 +119,13 @@
118119
<td class="sec_tab_type"><strong>: <span id="rProjectMilestone"></span></strong></td>
119120
</tr>
120121
<tr></tr>
122+
<%--
123+
<tr>
124+
<td class="first_tab_type"><strong>Product</strong></td>
125+
<td class="sec_tab_type"><strong>: <span id="rProduct"></span></strong></td>
126+
</tr>
127+
<tr></tr>
128+
--%>
121129
<tr>
122130
<td class="first_tab_type"><strong>Copilot</strong></td>
123131
<td class="sec_tab_type"><strong>: <span id="rCopilots"></span></strong></td>
@@ -251,7 +259,15 @@
251259
</select>
252260
</div>
253261
</div>
254-
<br /> <br />
262+
<br /> <br /><br />
263+
<%--
264+
<span class="name fixWidthName"><strong>Product</strong></span>
265+
<span class="value">
266+
<input type="text" class="bigin" id="productName" />
267+
<span id="productNameText"></span>
268+
</span>
269+
<br/><br/>
270+
--%>
255271
<!-- Review Scorecard -->
256272
<div id="reviewScorecardDivEdit">
257273
<br />

Diff for: src/web/WEB-INF/includes/contest/editTabMarathon.jsp

+16-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@
8787
<td class="sec_tab_type"><strong>: <span id="rProjectName"><c:out value="${sessionData.currentProjectContext.name}" /></span></strong></td>
8888
</tr>
8989
<tr></tr>
90+
<%--
91+
<tr>
92+
<td class="first_tab_type"><strong>Product</strong></td>
93+
<td class="sec_tab_type"><strong>: <span id="rProduct"></span></strong></td>
94+
</tr>
95+
<tr></tr>
96+
--%>
9097
<tr>
9198
<td class="first_tab_type"><strong>Copilot</strong></td>
9299
<td class="sec_tab_type"><strong>: <span id="rCopilots"></span></strong></td>
@@ -206,7 +213,15 @@
206213
</select>
207214
</div>
208215
</div>
209-
<br /><br />
216+
<br /><br /><br />
217+
<%--
218+
<span class="name fixWidthName"><strong>Product</strong></span>
219+
<span class="value">
220+
<input type="text" class="bigin" id="productName" />
221+
<span id="productNameText"></span>
222+
</span>
223+
<br/><br/>
224+
--%>
210225
<div id="copilotEditDiv">
211226
<br />
212227
<span class="name fixWidthName"><strong>Copilot</strong></span>

Diff for: src/web/WEB-INF/includes/contest/editTabSoftware.jsp

+16-2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@
139139
<td class="sec_tab_type"><strong>: <span id="rProjectMilestone"></span></strong></td>
140140
</tr>
141141
<tr></tr>
142+
<%--
143+
<tr>
144+
<td class="first_tab_type"><strong>Product</strong></td>
145+
<td class="sec_tab_type"><strong>: <span id="rProduct"></span></strong></td>
146+
</tr>
147+
<tr></tr>
148+
--%>
142149
<tr>
143150
<td class="first_tab_type"><strong>Copilot</strong></td>
144151
<td class="sec_tab_type"><strong>: <span id="rCopilots"></span></strong></td>
@@ -274,8 +281,15 @@
274281
</div>
275282
<div class="clearFix"></div>
276283
</div>
277-
278-
284+
<br/><br/>
285+
<%--
286+
<span class="name fixWidthName"><strong>Product</strong></span>
287+
<span class="value">
288+
<input type="text" class="bigin" id="productName" />
289+
<span id="productNameText"></span>
290+
</span>
291+
<br/><br/>
292+
---%>
279293
<div id="copilotEditDiv" class="editDropDown">
280294
<span class="name fixWidthName"><strong>Copilot</strong></span>
281295

Diff for: src/web/WEB-INF/includes/launch/contestSelection.jsp

+7
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@
158158
<a href="javascript:;" target="_blank" class="addMilestone hide">Manage Project Milestones</a>
159159
</div>
160160

161+
<!-- product -->
162+
<%--
163+
<div class="row">
164+
<label>Product :</label>
165+
<input id="productName" name="productName" type="text" class="text"/>
166+
</div>
167+
--%>
161168
<!-- Copilot for Software Contest -->
162169
<div class="row">
163170
<label>Copilot :</label>

Diff for: src/web/scripts/common.js

-3
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ function limitContestProjectNameChars(maxChars) {
130130
var textArea = $(this);
131131
var content = textArea.val();
132132
var invalid = false;
133-
if (content.search(invalidCharsRegExp, '') > -1) {
134-
invalid = true;
135-
}
136133
if (content.length <= maxChars && !invalid) {
137134
ori = content;
138135
}

Diff for: src/web/scripts/launch/contestDetailSoftware.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,13 @@ function populateTypeSection() {
12221222

12231223
$('#chkboxCCA').attr('checked', mainWidget.softwareCompetition.projectHeader.isLccchecked());
12241224

1225-
//display
1225+
//product
1226+
/*
1227+
if (mainWidget.softwareCompetition.projectHeader.properties[PRODUCT_SKU] != null){
1228+
$("#rProduct").text(mainWidget.softwareCompetition.projectHeader.properties[PRODUCT_SKU]);
1229+
$("#productName").val(mainWidget.softwareCompetition.projectHeader.properties[PRODUCT_SKU]);
1230+
}
1231+
*/
12261232
$('#rContestTypeName').text($("#contestTypes option[value=" + mainWidget.competitionType + mainWidget.softwareCompetition.projectHeader.projectCategory.id +"]").text());
12271233

12281234
loadReviewScorecardList(null);
@@ -1513,7 +1519,7 @@ function validateFieldsTypeSection() {
15131519
if (categoryId == SOFTWARE_CATEGORY_ID_F2F) {
15141520
// set review scorecard.
15151521
mainWidget.softwareCompetition.projectHeader.iterativeReviewScorecardId = parseInt($('select#reviewScorecardSelects').val());
1516-
} else {
1522+
} else if (categoryId != ALGORITHM_CATEGORY_ID_MARATHON){
15171523
// set iterative review scorecard
15181524
mainWidget.softwareCompetition.projectHeader.reviewScorecardId = parseInt($('select#reviewScorecardSelects').val());
15191525
}

Diff for: src/web/scripts/launch/entity.js

+2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ var STUDIO_IDEA_GENERATION = 22;
194194
var DRAFT_STATUS = "Draft";
195195
var ACTIVE_STATUS = "Active";
196196

197+
var PRODUCT_SKU ="Product SKU";
198+
197199
var projectCategoryArray = [
198200
{id:SOFTWARE_CATEGORY_ID_CONCEPT, name:'CONCEPTUALIZATION', label:'Software Conceptualization', typeId:2, typeName:'Application', hasMulti:true, hideInDropdown: true},
199201
{id:SOFTWARE_CATEGORY_ID_SPEC, name:'SPECIFICATION', label:'Software Specification', typeId:2, typeName:'Application', hasMulti:true, hideInDropdown: true},

Diff for: src/web/scripts/launch/main.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,13 @@ function saveAsDraftRequest() {
10391039

10401040
mainWidget.softwareCompetition.projectHeader.properties['Review Type'] = reviewType;
10411041
}
1042-
1042+
/*
1043+
if ($("#productName").val().trim().length > 0) {
1044+
mainWidget.softwareCompetition.projectHeader.properties[PRODUCT_SKU] = $("#productName").val().trim();
1045+
}else{
1046+
mainWidget.softwareCompetition.projectHeader.properties[PRODUCT_SKU] = "";
1047+
}
1048+
*/
10431049

10441050
var request;
10451051

0 commit comments

Comments
 (0)