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

Commit a248260

Browse files
authored
Merge pull request #354 from deedee/mm_registrants_tab
MM registrants tab
2 parents 5ccd262 + 367eb4e commit a248260

File tree

4 files changed

+306
-35
lines changed

4 files changed

+306
-35
lines changed

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

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

@@ -58,8 +58,15 @@
5858
* <li>Add {@link #MM_MATCH_ID_KEY}</li>
5959
* </ul>
6060
* </p>
61+
*
62+
* <p>
63+
* Version 1.2.9 (Topcoder - Implement Registrants tab For Marathon Match Challenges In Direct App)
64+
* <ul>
65+
* <li>Added {@link #MM_TYPE_KEY}</li>
66+
* </ul>
67+
* </p>
6168
* @author tuenm, iamajia, flytoj2ee, tangzx, GreatKevin, TCSCODER
62-
* @version 1.2.8
69+
* @version 1.2.9
6370
* @since 1.0
6471
*/
6572
public class ProjectPropertyType implements Serializable {
@@ -411,6 +418,12 @@ public class ProjectPropertyType implements Serializable {
411418
*/
412419
public static final Long MM_CONTEST_ID = 86L;
413420

421+
/**
422+
* Represent "Marathon Match Type" key
423+
* @since 1.2.9
424+
*/
425+
public static final String MM_TYPE_KEY = "Marathon Match Type";
426+
414427
/**
415428
* Represents the id of this instance. Only values greater than zero is
416429
* allowed. This variable is initialized in the constructor and can be

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

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

@@ -13,6 +13,9 @@
1313
import com.topcoder.direct.services.view.util.DataProvider;
1414
import com.topcoder.direct.services.view.util.DirectUtils;
1515
import com.topcoder.direct.services.view.util.SessionData;
16+
import com.topcoder.management.project.Project;
17+
import com.topcoder.management.project.ProjectCategory;
18+
import com.topcoder.management.project.ProjectPropertyType;
1619
import com.topcoder.security.TCSubject;
1720
import com.topcoder.service.facade.contest.ContestServiceFacade;
1821
import com.topcoder.service.project.SoftwareCompetition;
@@ -68,8 +71,14 @@
6871
* load these data via ajax instead after the page finishes loading.
6972
* </p>
7073
*
71-
* @author isv, GreatKevin, Veve
72-
* @version 1.6
74+
* <p>
75+
* Version 1.7 (Topcoder - Implement Registrants tab For Marathon Match Challenges In Direct App)
76+
* <ul>
77+
* <li>Add support for registrants tab for Marathon Match</li>
78+
* </ul>
79+
* </p>
80+
* @author isv, GreatKevin, Veve, TCSCODER
81+
* @version 1.7
7382
*/
7483
public class ContestRegistrantsAction extends StudioOrSoftwareContestAction {
7584

@@ -180,7 +189,36 @@ public void executeAction() throws Exception {
180189
// Set registrants data
181190
long contestId = getProjectId();
182191
SoftwareCompetition competition = contestServiceFacade.getSoftwareContestByProjectId(currentUser, contestId);
183-
List<Registrant> registrants = contestServiceFacade.getRegistrantsForProject(currentUser, contestId);
192+
List<Registrant> registrants = new ArrayList<Registrant>();
193+
Project project = competition.getProjectHeader();
194+
195+
if (project.getProjectCategory().getId() == ProjectCategory.MARATHON_MATCH.getId()) {
196+
Long mmContestId = project.getProperty(ProjectPropertyType.MM_CONTEST_ID_KEY) == null ||
197+
"".equals(project.getProperty(ProjectPropertyType.MM_CONTEST_ID_KEY)) ? null :
198+
Long.valueOf(project.getProperty(ProjectPropertyType.MM_CONTEST_ID_KEY));
199+
Long roundId = project.getProperty(ProjectPropertyType.MM_MATCH_ID_KEY) == null ||
200+
"".equals(project.getProperty(ProjectPropertyType.MM_MATCH_ID_KEY)) ? null :
201+
Long.valueOf(project.getProperty(ProjectPropertyType.MM_MATCH_ID_KEY));
202+
203+
//get from resource
204+
if (project.getProperty(ProjectPropertyType.MM_TYPE_KEY) != null &&
205+
!"".equals(project.getProperty(ProjectPropertyType.MM_TYPE_KEY))) {
206+
registrants = contestServiceFacade.getRegistrantsForProject(currentUser, contestId);
207+
}
208+
209+
//try from round_registraion
210+
if (registrants.isEmpty()) {
211+
if (mmContestId != null || roundId != null)
212+
registrants = DirectUtils.getMMRegistrants(mmContestId, roundId);
213+
} else {
214+
//set MM rating
215+
DirectUtils.getMMRegistrantsRating(registrants);
216+
}
217+
//get submission date
218+
DirectUtils.getMMRegistantsSubmissionInfo(registrants, mmContestId, roundId);
219+
} else {
220+
registrants = contestServiceFacade.getRegistrantsForProject(currentUser, contestId);
221+
}
184222

185223
getViewData().setContestId(contestId);
186224
getViewData().setContestRegistrants(registrants);

0 commit comments

Comments
 (0)