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

Commit 1b60cbb

Browse files
author
sachin-maheshwari
authored
Merge pull request #514 from appirio-tech/dev
changes to integrate v5-groups-api, new sub category "Automated Testing" and for Topgear billing, default group auto select.
2 parents 4437a5a + 24e0e40 commit 1b60cbb

File tree

35 files changed

+943
-556
lines changed

35 files changed

+943
-556
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ workflows:
9090
context : org-global
9191
filters:
9292
branches:
93-
only: [dev, dev-sts]
93+
only: [dev, fix_v5_groups, dev-sts]
9494
- build-qa:
9595
context : org-global
9696
filters:

components/online_review_upload_services/src/java/main/com/cronos/onlinereview/services/uploads/impl/DefaultUploadServices.java

+1
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,7 @@ private static boolean isProjectResultCategory(long categoryId) {
16661666
|| categoryId == 38 // First2Finish
16671667
|| categoryId == 39 // Code
16681668
|| categoryId == 40 // Design F2F (NEW)
1669+
|| categoryId == 41 // Automated Testing
16691670
);
16701671
}
16711672

components/project_management/src/java/main/com/topcoder/management/project/ProjectCategory.java

+8
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,13 @@ public class ProjectCategory implements Serializable {
205205
*/
206206
public static final ProjectCategory DESIGN_FIRST2FINISH = new ProjectCategory(40, "Design First2Finish", ProjectType.STUDIO);
207207

208+
/**
209+
* The project category for Design First2Finish
210+
*
211+
* @since 1.6
212+
*/
213+
public static final ProjectCategory AUTOMATED_TESTING = new ProjectCategory(41, "Automated Testing", ProjectType.APPLICATION);
214+
208215
/**
209216
* Map to store the mapping of project category id to <code>ProjectCategory</code> instance.
210217
*
@@ -248,6 +255,7 @@ public class ProjectCategory implements Serializable {
248255
PROJECT_CATEGORIES.put(DESIGN_FIRST2FINISH.getId(), DESIGN_FIRST2FINISH);
249256
PROJECT_CATEGORIES.put(CODE.getId(), CODE);
250257
PROJECT_CATEGORIES.put(MARATHON_MATCH.getId(), MARATHON_MATCH);
258+
PROJECT_CATEGORIES.put(AUTOMATED_TESTING.getId(), AUTOMATED_TESTING);
251259
}
252260

253261
/**

components/project_management/src/java/main/com/topcoder/management/project/ProjectGroup.java

+31
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
* @author TCSCODER
1818
* @version 1.0
1919
*/
20+
21+
/**
22+
* <p>
23+
* Changes related to v5-groups-api
24+
* </p>
25+
*
26+
* @author dushyantb
27+
* @version 1.1
28+
*/
29+
2030
public class ProjectGroup implements Serializable {
2131
/**
2232
* Represents group id
@@ -27,6 +37,11 @@ public class ProjectGroup implements Serializable {
2737
* Represents group name
2838
*/
2939
private String name;
40+
41+
/**
42+
* Represent new Id format
43+
*/
44+
private String newId;
3045

3146
/**
3247
* Constructor
@@ -76,4 +91,20 @@ public String getName() {
7691
public void setName(String name) {
7792
this.name = name;
7893
}
94+
95+
/**
96+
* Getter for {@link #newId}
97+
* @return
98+
*/
99+
public String getNewId() {
100+
return newId;
101+
}
102+
103+
/**
104+
* Setter for {@link #newId}
105+
* @param newId
106+
*/
107+
public void setNewId(String newId) {
108+
this.newId = newId;
109+
}
79110
}

components/project_management/src/java/main/com/topcoder/management/project/persistence/AbstractInformixProjectPersistence.java

+1
Original file line numberDiff line numberDiff line change
@@ -3646,6 +3646,7 @@ public long getScorecardId(long projectTypeId, int scorecardTypeId) throws Persi
36463646
ps.setInt(2, scorecardTypeId);
36473647
rs = ps.executeQuery();
36483648
if (rs.next()) {
3649+
getLogger().log(Level.INFO, "Scorecard selected for category " + projectTypeId + " scorecard type " + scorecardTypeId + "; selected scorecard " + rs.getInt("scorecard_id"));
36493650
return rs.getInt("scorecard_id");
36503651
} else {
36513652
throw new RuntimeException("Cannot find default scorecard id for project type: " +

conf/Direct.properties

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ JWT_V3_SECRET = @JWT_V3_SECRET@
2222

2323
#Parameter whether we use login processor or not
2424
USE_LOGIN_PROCESSOR = @useLoginProcessor@
25+
TRIAL_BILLING_ID = @trialBillingId@

conf/contestFees.xml

+28
Original file line numberDiff line numberDiff line change
@@ -573,5 +573,33 @@
573573
</billingLevel>
574574
</contestCost>
575575
</contestType>
576+
<contestType contestTypeId="41">
577+
<!-- Code -->
578+
<contestFee>0</contestFee>
579+
<specReviewCost>0</specReviewCost>
580+
<contestCost>
581+
<billingLevel id="low">
582+
<firstPlaceCost>350</firstPlaceCost>
583+
<secondPlaceCost>150</secondPlaceCost>
584+
<reviewBoardCost>672</reviewBoardCost>
585+
<reliabilityBonusCost>0</reliabilityBonusCost>
586+
<drCost>0</drCost>
587+
</billingLevel>
588+
<billingLevel id="medium">
589+
<firstPlaceCost>350</firstPlaceCost>
590+
<secondPlaceCost>150</secondPlaceCost>
591+
<reviewBoardCost>672</reviewBoardCost>
592+
<reliabilityBonusCost>0</reliabilityBonusCost>
593+
<drCost>0</drCost>
594+
</billingLevel>
595+
<billingLevel id="high">
596+
<firstPlaceCost>350</firstPlaceCost>
597+
<secondPlaceCost>150</secondPlaceCost>
598+
<reviewBoardCost>672</reviewBoardCost>
599+
<reliabilityBonusCost>0</reliabilityBonusCost>
600+
<drCost>0</drCost>
601+
</billingLevel>
602+
</contestCost>
603+
</contestType>
576604
</contestTypes>
577605

conf/copilotFees.xml

+3
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,8 @@
113113
<contestType contestTypeId="40"><!-- Design First2Finish -->
114114
<copilotFee>40</copilotFee>
115115
</contestType>
116+
<contestType contestTypeId="41"><!-- Design First2Finish -->
117+
<copilotFee>600</copilotFee>
118+
</contestType>
116119
</contestTypes>
117120

conf/objectFactory_config.xml

+1
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,7 @@
18361836
<Value>phase_templates/TCSTemplate_F2F.xml</Value>
18371837
<Value>phase_templates/TCSTemplate_Code.xml</Value>
18381838
<Value>phase_templates/TCSTemplate_Design_F2F.xml</Value>
1839+
<Value>phase_templates/TCSTemplate_Automated_Testing.xml</Value>
18391840
</Property>
18401841
</Config>
18411842

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0"?>
2+
<!-- A template which defines a set of project phases for the Code contest category -->
3+
<Template name="Automated Testing">
4+
<!-- An enumeration of project phase types defined in this template -->
5+
<PhaseTypes>
6+
<PhaseType id="registration" typeId="1" typeName="Registration"/>
7+
<PhaseType id="submission" typeId="2" typeName="Submission"/>
8+
<PhaseType id="review" typeId="4" typeName="Review"/>
9+
<PhaseType id="appeals" typeId="5" typeName="Appeals"/>
10+
<PhaseType id="appeals_response" typeId="6" typeName="Appeals Response"/>
11+
</PhaseTypes>
12+
<!-- A set of project phases defined in this template. -->
13+
<Phases>
14+
<Phase id="registrationPhase" length="432000000" type="registration" phaseId="1">
15+
</Phase>
16+
17+
<Phase id="submissionPhase" length="432000000" type="submission" phaseId="2">
18+
<Dependency id="registrationPhase" isDependencyStart="true" isDependentStart="true" lagTime="300000"/>
19+
</Phase>
20+
21+
<Phase id="reviewPhase" length="172800000" type="review" phaseId="4">
22+
<Dependency id="submissionPhase" isDependentStart="true" lagTime="0"/>
23+
</Phase>
24+
<Phase id="appealsPhase" length="86400000" type="appeals" phaseId="5">
25+
<!-- "isDependentStart" is optional attribute(default to "true"), here it is omitted -->
26+
<Dependency id="reviewPhase" isDependencyStart="false" lagTime="0"/>
27+
</Phase>
28+
29+
<Phase id="appealsReponsePhase" length="43200000" type="appeals_response" phaseId="6">
30+
<!-- "lagTime" is optional attribute(default to "0"), here it is omitted -->
31+
<Dependency id="appealsPhase" isDependencyStart="false" isDependentStart="true"/>
32+
</Phase>
33+
34+
</Phases>
35+
</Template>

conf/web/WEB-INF/applicationContext.xml

+2
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@
467467
parent="contestAction" scope="prototype">
468468
<property name="type" value="CONTEST_JSON" />
469469
<property name="timelineInterval" value="1"/>
470+
<property name="userGroupsApiEndpoint" value="@userGroupsApiEndpoint@"/>
470471
<!--
471472
<property name="marathonMatchAnalyticsService" ref="marathonMatchAnalyticsService"/>
472473
-->
@@ -1480,6 +1481,7 @@
14801481
<value>phase_templates/TCSTemplate_F2F.xml</value>
14811482
<value>phase_templates/TCSTemplate_Code.xml</value>
14821483
<value>phase_templates/TCSTemplate_Design_F2F.xml</value>
1484+
<value>phase_templates/TCSTemplate_Automated_Testing.xml</value>
14831485
</list>
14841486
</constructor-arg>
14851487
</bean>

services/project_services/src/java/main/com/topcoder/project/service/impl/ProjectServicesImpl.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -5034,7 +5034,6 @@ private String getPhaseTemplateName(Project projectHeader) {
50345034
return t;
50355035
}
50365036
}
5037-
50385037
return null;
50395038
}
50405039

@@ -5130,7 +5129,8 @@ private void setNewPhasesProperties(Project projectHeader,
51305129

51315130

51325131
if (projectHeader.getProjectCategory().getId() != ProjectCategory.BUG_HUNT.getId()
5133-
&& projectHeader.getProjectCategory().getId() != ProjectCategory.CODE.getId()) {
5132+
&& projectHeader.getProjectCategory().getId() != ProjectCategory.CODE.getId()
5133+
&& projectHeader.getProjectCategory().getId() != ProjectCategory.AUTOMATED_TESTING.getId()) {
51345134
// bug hunt/code does not have these
51355135
screenTemplateId = projectManager.getScorecardId(projectHeader.getProjectCategory().getId(), 1);
51365136
approvalTemplateId = projectManager.getScorecardId(ProjectCategory.GENERIC_SCORECARDS.getId(), 3);
@@ -5139,7 +5139,9 @@ private void setNewPhasesProperties(Project projectHeader,
51395139
reviewTemplateId = projectManager.getScorecardId(projectHeader.getProjectCategory().getId(), 2);
51405140

51415141
if (projectHeader.getProjectCategory().getId() != ProjectCategory.CODE.getId()) {
5142-
specReviewTemplateId = projectManager.getScorecardId(projectHeader.getProjectCategory().getId(), 5);
5142+
if (projectHeader.getProjectCategory().getId() != ProjectCategory.AUTOMATED_TESTING.getId()) {
5143+
specReviewTemplateId = projectManager.getScorecardId(projectHeader.getProjectCategory().getId(), 5);
5144+
}
51435145
}
51445146

51455147
if (multiRound) {
@@ -5169,6 +5171,8 @@ private void setNewPhasesProperties(Project projectHeader,
51695171
}
51705172
}
51715173

5174+
5175+
51725176
for (Phase p : projectPhases.getAllPhases()) {
51735177
p.setPhaseStatus(PhaseStatus.SCHEDULED);
51745178
p.setScheduledStartDate(p.calcStartDate());

src/java/main/com/topcoder/direct/services/view/action/contest/launch/CommonAction.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,15 @@
9999
* <li>Add enable effort hours</li>
100100
* </ul>
101101
* </p>
102+
*
103+
* <p>
104+
* Version 1.11 (Topcoder - Integrate Direct with Groups V5)
105+
* <ul>
106+
* <li>Refactor projectGroup to comply with v5</li>
107+
* </ul>
108+
* </p>
102109
*
103-
* @author BeBetter, pvmagacho, GreatKevin, bugbuka, GreatKevin
110+
* @author BeBetter, pvmagacho, GreatKevin, bugbuka, GreatKevin, dushyantb
104111
* @version 1.10
105112
*/
106113
public class CommonAction extends BaseContestFeeAction {
@@ -575,7 +582,7 @@ public void setCategoryId(long categoryId) {
575582
public String getGroups() {
576583
try {
577584
TCSubject tcSubject = DirectUtils.getTCSubjectFromSession();
578-
Set<ProjectGroup> projectGroups = DirectUtils.getGroups(tcSubject, userGroupsApiEndpoint);
585+
Set<Map<String, String>> projectGroups = DirectUtils.getGroups(tcSubject, userGroupsApiEndpoint);
579586
setResult(projectGroups);
580587
} catch (Throwable e) {
581588
if (getModel() != null) {

src/java/main/com/topcoder/direct/services/view/action/contest/launch/GetContestAction.java

+40-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.topcoder.direct.services.view.util.SessionData;
2222
import com.topcoder.management.deliverable.Submission;
2323
import com.topcoder.management.project.Prize;
24+
import com.topcoder.management.project.ProjectGroup;
2425
import com.topcoder.management.resource.Resource;
2526
import com.topcoder.management.resource.ResourceRole;
2627
import com.topcoder.security.TCSubject;
@@ -37,13 +38,7 @@
3738

3839
import javax.servlet.http.HttpServletRequest;
3940
import javax.servlet.http.HttpSession;
40-
import java.util.ArrayList;
41-
import java.util.Arrays;
42-
import java.util.Collections;
43-
import java.util.Comparator;
44-
import java.util.HashMap;
45-
import java.util.List;
46-
import java.util.Map;
41+
import java.util.*;
4742

4843
/**
4944
* <p>
@@ -274,6 +269,14 @@
274269
*
275270
* @author fabrizyo, FireIce, isv, morehappiness, GreatKevin, minhu, Veve, Ghost_141, GreatKevin, Veve, GreatKevin, TCSCODER
276271
* @version 3.5
272+
*
273+
* * <p>
274+
* Version 3.6 - Topcoder - Integrate Direct with Groups V5
275+
* - Refactor projectGroup to comply with v5
276+
* </p>
277+
*
278+
* @author fabrizyo, FireIce, isv, morehappiness, GreatKevin, minhu, Veve, Ghost_141, GreatKevin, Veve, GreatKevin, TCSCODER, dushyantb
279+
* @version 3.6
277280
*/
278281
public class GetContestAction extends ContestAction {
279282
/**
@@ -401,6 +404,11 @@ public class GetContestAction extends ContestAction {
401404
*/
402405
private boolean showSaveChallengeConfirmation;
403406

407+
/**
408+
* Endpoint to group of a user
409+
*/
410+
private String userGroupsApiEndpoint;
411+
404412
/**
405413
* <p>
406414
* Creates a <code>GetContestAction</code> instance.
@@ -463,8 +471,23 @@ protected void executeAction() throws Exception {
463471
if (DirectUtils.isStudio(softwareCompetition)) {
464472
softwareCompetition.setType(CompetionType.STUDIO);
465473
}
466-
softwareCompetition.getProjectHeader().setGroups(DirectUtils.getGroupIdAndName(
467-
softwareCompetition.getProjectHeader().getGroups()));
474+
List<ProjectGroup> projectGroups = DirectUtils.getGroupIdAndName(
475+
softwareCompetition.getProjectHeader().getGroups());
476+
477+
if (projectGroups != null && this.type == TYPE.CONTEST_JSON) {
478+
// get v5 id of groups
479+
Set<Map<String, String>> projectGroupUser = DirectUtils.getGroups(DirectUtils.getTCSubjectFromSession(),
480+
userGroupsApiEndpoint);
481+
for (ProjectGroup pg : projectGroups) {
482+
for (Map<String, String> pgu : projectGroupUser) {
483+
if (String.valueOf(pg.getId()).equals(pgu.get("oldId"))) {
484+
pg.setNewId(pgu.get("id"));
485+
break;
486+
}
487+
}
488+
}
489+
}
490+
softwareCompetition.getProjectHeader().setGroups(projectGroups);
468491

469492
setResult(softwareCompetition);
470493
regEndDate = DirectUtils.getDateString(DirectUtils.getRegistrationEndDate(softwareCompetition));
@@ -974,4 +997,12 @@ public boolean isShowSaveChallengeConfirmation() {
974997
return showSaveChallengeConfirmation;
975998
}
976999

1000+
public String getUserGroupsApiEndpoint() {
1001+
return userGroupsApiEndpoint;
1002+
}
1003+
1004+
public void setUserGroupsApiEndpoint(String userGroupsApiEndpoint) {
1005+
this.userGroupsApiEndpoint = userGroupsApiEndpoint;
1006+
}
1007+
9771008
}

0 commit comments

Comments
 (0)