|
1 | 1 | /*
|
2 |
| - * Copyright (C) 2010 - 2014 TopCoder Inc., All Rights Reserved. |
| 2 | + * Copyright (C) 2010 - 2018 TopCoder Inc., All Rights Reserved. |
3 | 3 | */
|
4 | 4 | package com.topcoder.direct.services.view.action.contest;
|
5 | 5 |
|
|
13 | 13 | import com.topcoder.direct.services.view.util.DataProvider;
|
14 | 14 | import com.topcoder.direct.services.view.util.DirectUtils;
|
15 | 15 | 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; |
16 | 19 | import com.topcoder.security.TCSubject;
|
17 | 20 | import com.topcoder.service.facade.contest.ContestServiceFacade;
|
18 | 21 | import com.topcoder.service.project.SoftwareCompetition;
|
|
68 | 71 | * load these data via ajax instead after the page finishes loading.
|
69 | 72 | * </p>
|
70 | 73 | *
|
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 |
73 | 82 | */
|
74 | 83 | public class ContestRegistrantsAction extends StudioOrSoftwareContestAction {
|
75 | 84 |
|
@@ -180,7 +189,36 @@ public void executeAction() throws Exception {
|
180 | 189 | // Set registrants data
|
181 | 190 | long contestId = getProjectId();
|
182 | 191 | 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 | + } |
184 | 222 |
|
185 | 223 | getViewData().setContestId(contestId);
|
186 | 224 | getViewData().setContestRegistrants(registrants);
|
|
0 commit comments