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

Commit 56215a1

Browse files
committed
development challenge and code work step type
1 parent 6fc641d commit 56215a1

File tree

10 files changed

+333
-63
lines changed

10 files changed

+333
-63
lines changed

conf/web/WEB-INF/applicationContext.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@
297297
<bean id="projectWorkManagementAction"
298298
class="com.topcoder.direct.services.view.action.project.ProjectWorkManagementAction" scope="prototype" parent="baseDirectStrutsAction">
299299
<property name="studioSubmissionBase" value="@studio.submission.base@"/>
300+
<property name="softwareSubmissionBase" value="@file_storage_location@"/>
300301
<property name="mimeTypeRetriever" ref="mimeTypeRetriever"/>
301302
</bean>
302303

conf/web/WEB-INF/struts.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@
789789
<result name="error" type="json"/>
790790
</action>
791791

792-
<action name="getWorkStepDesignChallenges" method="getDesignChallenges" class="projectWorkManagementAction">
792+
<action name="getWorkStepChallenges" method="getChallengesForWorkStepAndProject" class="projectWorkManagementAction">
793793
<interceptor-ref name="securedProjectPreProcessorStack"/>
794794
<result name="success" type="json"/>
795795
<result name="error" type="json"/>

conf/web/WEB-INF/tld/tcdirect-functions.tld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@
171171
<function-class>com.topcoder.direct.services.view.util.JSPHelper</function-class>
172172
<function-signature>boolean hasPermissionToAccessWorkManager(long)</function-signature>
173173
</function>
174+
175+
<function>
176+
<name>getDemandWorkId</name>
177+
<function-class>com.topcoder.direct.services.view.util.JSPHelper</function-class>
178+
<function-signature>java.lang.String getDirectProjectDemandWorkId(long)</function-signature>
179+
</function>
174180

175181
<function>
176182
<name>maxLong</name>

src/java/main/com/topcoder/direct/services/view/action/project/ProjectWorkManagementAction.java

Lines changed: 258 additions & 47 deletions
Large diffs are not rendered by default.

src/java/main/com/topcoder/direct/services/view/util/DataProvider.java

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,8 @@ public static LatestActivitiesDTO getLatestActivitiesForUserProjects(long userId
14371437
final Map<Long, ProjectBriefDTO> projects = new HashMap<Long, ProjectBriefDTO>();
14381438
final Map<Long, TypedContestBriefDTO> contests = new HashMap<Long, TypedContestBriefDTO>();//here
14391439

1440-
final ResultSetContainer resultContainer = dataAccessor.getData(request).get("direct_latest_activities_replatforming");
1440+
final ResultSetContainer resultContainer = dataAccessor.getData(request).get(
1441+
"direct_latest_activities_replatforming");
14411442
final int recordNum = resultContainer.size();
14421443

14431444
for (int i = 0; i < recordNum; i++) {
@@ -2043,7 +2044,7 @@ private static List<ForumPoster> getLatestThreePosters(String lastPosters) throw
20432044
public static List<DashboardContestSearchResultDTO> searchUserContests(TCSubject tcSubject, String searchFor,
20442045
final Date begin, final Date end) throws Exception {
20452046
List<CommonProjectContestData> contests = DirectUtils.getContestServiceFacade().getCommonProjectContestData(
2046-
tcSubject);
2047+
tcSubject);
20472048
List<CommonProjectContestData> filteredContests;
20482049
if (StringUtils.isBlank(searchFor) && begin == null && end == null) {
20492050
filteredContests = contests;
@@ -2416,7 +2417,7 @@ public static void getDashboardProjectMetricsReport(TCSubject currentUser, long
24162417
stats.setTotalBudget(row.getStringItem("total_budget"));
24172418
stats.setActualCost(row.getDoubleItem("actual_cost"));
24182419
stats.setStartDate(getDate(row,"create_date"));
2419-
stats.setCompletionDate(getDate(row,"completion_date"));
2420+
stats.setCompletionDate(getDate(row, "completion_date"));
24202421
stats.setTotalContests(row.getIntItem("total_number"));
24212422

24222423
// draft
@@ -2440,8 +2441,8 @@ public static void getDashboardProjectMetricsReport(TCSubject currentUser, long
24402441
stats.setCostCanceled(row.getDoubleItem("cost_cancelled"));
24412442

24422443
stats.setProjectedCost(row.getDoubleItem("cost_draft") + row.getDoubleItem("cost_scheduled") +
2443-
row.getDoubleItem("cost_active") + row.getDoubleItem("cost_finished") +
2444-
row.getDoubleItem("cost_cancelled") + row.getDoubleItem("project_level_cost"));
2444+
row.getDoubleItem("cost_active") + row.getDoubleItem("cost_finished") +
2445+
row.getDoubleItem("cost_cancelled") + row.getDoubleItem("project_level_cost"));
24452446

24462447
stats.setPlannedCost(row.getDoubleItem("planned_cost"));
24472448
statses.add(stats);
@@ -3006,7 +3007,8 @@ public static List<TypedContestBriefDTO> getProjectTypedContests(long userId, lo
30063007
final Map<Long, ProjectBriefDTO> projects = new HashMap<Long, ProjectBriefDTO>();
30073008
final List<TypedContestBriefDTO> contests = new ArrayList<TypedContestBriefDTO>();
30083009

3009-
final ResultSetContainer resultContainer = dataAccessor.getData(request).get("direct_my_typed_contests_replatforming");
3010+
final ResultSetContainer resultContainer = dataAccessor.getData(request).get(
3011+
"direct_my_typed_contests_replatforming");
30103012
final int recordNum = resultContainer.size();
30113013
for (int i = 0; i < recordNum; i++) {
30123014
long tcDirectProjectId = resultContainer.getLongItem(i, "tc_direct_project_id");
@@ -7282,7 +7284,7 @@ public static List<EnterpriseDashboardMonthPipelineDTO> getEnterpriseDashboardCo
72827284
String phases = resultContainer.getStringItem(i, "phases");
72837285

72847286
long monthCount = resultContainer.getLongItem(i, "monthcount");
7285-
EnterpriseDashboardMonthPipelineDTO item = resultMap.get((monthCount/100) * 12 + (monthCount % 100) -1);
7287+
EnterpriseDashboardMonthPipelineDTO item = resultMap.get((monthCount / 100) * 12 + (monthCount % 100) - 1);
72867288

72877289
if (currentPhase != null && ((String)status).equalsIgnoreCase(ProjectStatus.ACTIVE.getName())) {
72887290
// active
@@ -7499,7 +7501,7 @@ else if (((String)status).equalsIgnoreCase(ProjectStatus.DRAFT.getName()))
74997501
long monthCount = resultContainer.getLongItem(i, "monthcount");
75007502

75017503
EnterpriseDashboardMonthProjectPipelineDTO item =
7502-
resultMap.get((monthCount/100) * 12 + (monthCount % 100) -1);
7504+
resultMap.get((monthCount / 100) * 12 + (monthCount % 100) - 1);
75037505

75047506
if (projectStatusId == 4L) {
75057507
item.setTotalCompletedProjects(item.getTotalCompletedProjects() + 1);
@@ -7914,6 +7916,34 @@ public static InputStream generateWinnerSheet(long tcDirectProjectId) throws Exc
79147916
return new ByteArrayInputStream(saveTo.toByteArray());
79157917
}
79167918

7919+
/**
7920+
* Gets the demand work id of the direct project, return null if the project does not exist or the direct project does not
7921+
* demand work id.
7922+
*
7923+
* @param tcDirectProjectId the id of the direct project
7924+
* @return the demand work id of the direct project or null the project does not exist or the direct project does not
7925+
* demand work id.
7926+
* @throws Exception if any error
7927+
*/
7928+
public static String getDirectProjectDemandWorkId(long tcDirectProjectId) throws Exception {
7929+
DataAccess dataAccessor = new DataAccess(DBMS.TCS_OLTP_DATASOURCE_NAME);
7930+
Request request = new Request();
7931+
request.setContentHandle("project_name");
7932+
request.setProperty("tcdirectid", String.valueOf(tcDirectProjectId));
7933+
ResultSetContainer resultSetContainer = dataAccessor.getData(request).get("project_contest_results");
7934+
7935+
if (resultSetContainer != null && resultSetContainer.size() > 0) {
7936+
ResultSetRow resultSetRow = resultSetContainer.get(0);
7937+
if (resultSetRow.getItem("demand_work_id").getResultData() != null) {
7938+
return resultSetRow.getStringItem("demand_work_id");
7939+
} else {
7940+
return null;
7941+
}
7942+
}
7943+
7944+
return null;
7945+
}
7946+
79177947
/**
79187948
* <p>Generates the <code>Excel</code> worksheet with results for contests for specified <code>TC Direct</code>
79197949
* project.</p>

src/java/main/com/topcoder/direct/services/view/util/DirectUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ public final class DirectUtils {
854854
*
855855
* @since 1.8.5
856856
*/
857-
private static final int FINAL_FIX_UPLOAD_TYPE_ID = 3;
857+
public static final int FINAL_FIX_UPLOAD_TYPE_ID = 3;
858858

859859
private static final String IS_CLIENT_USER_SQL = "SELECT client_id FROM client_user_xref cux, user_account ua, common_oltp:user u"
860860
+ " WHERE cux.user_id = ua.user_account_id AND UPPER(ua.user_name) = UPPER(u.handle) AND u.user_id = ?";

src/java/main/com/topcoder/direct/services/view/util/JSPHelper.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,17 @@ public static boolean hasPermissionToAccessWorkManager(long projectId) throws Ex
668668
return AuthorizationProvider.isUserGrantedToAccessWorkManager(DirectUtils.getTCSubjectFromSession(), projectId);
669669
}
670670

671+
/**
672+
* Gets the demand work id of the specified direct project.
673+
*
674+
* @param projectId the id of the direct project.
675+
* @return the demand work id, null if no exist or no demand work id.
676+
* @throws Exception if any error occurs.
677+
*/
678+
public static String getDirectProjectDemandWorkId(long projectId) throws Exception {
679+
return DataProvider.getDirectProjectDemandWorkId(projectId);
680+
}
681+
671682
/**
672683
* Gets the current login user id.
673684
*

src/web/WEB-INF/includes/newHeader.jsp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,9 @@
490490
</li>
491491

492492
<c:set var="hasWorkManagerPermission" value="${tcdirect:hasPermissionToAccessWorkManager(session.currentSelectDirectProjectID)}" scope="request"/>
493+
<c:set var="demandWorkId" value="${tcdirect:getDemandWorkId(session.currentSelectDirectProjectID)}" scope="request"/>
493494

494-
<c:if test="${hasWorkManagerPermission}">
495+
<c:if test="${hasWorkManagerPermission && demandWorkId != null}">
495496
<li <c:if test="${requestScope.CURRENT_TAB eq 'workManagement'}">class="active"</c:if>>
496497
<a class="mil" href="<s:url action="projectWorkManager" namespace="/"> <s:param name="formData.projectId" value="sessionData.currentSelectDirectProjectID" /></s:url>"><span class="icon"></span>Work Manager</a>
497498
</li>

src/web/WEB-INF/project-work-management.jsp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<%@ page import="com.topcoder.shared.util.ApplicationServer" %>
12
<%--
23
- Author: TCSASSEMBLER
34
-
@@ -119,7 +120,16 @@
119120

120121
<!-- begin topLine -->
121122
<div class="projectVMManagement">
122-
<h2>Work Management</h2>
123+
124+
<%
125+
String[] splits = ApplicationServer.SERVER_NAME.split(".");
126+
String topServerName = "topcoder.com";
127+
if (splits != null && splits.length >= 2) {
128+
topServerName = splits[splits.length - 2] + "." + splits[splits.length - 1];
129+
}
130+
%>
131+
132+
<h2>Work Management</h2> <a href="https://work.<%=topServerName%>/customer/projects/${demandWorkId}/timeline" target="_blank">Work Manager Project</a>
123133
</div>
124134
<!-- end topLine -->
125135

src/web/scripts/projectWorkManager.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $(document).ready(function() {
1515
$.ajax({
1616
type: 'POST',
1717
url: ctx + "/pushSubmissions",
18-
data: {contestId: currentChallenge.id, phaseName: currentPhase.label, workStepId: currentWorkStep.id, formData: {projectId: tcDirectProjectId}},
18+
data: {contestId: currentChallenge.id, phaseName: currentPhase.label, workStepId: currentWorkStep.id, workStepName: currentWorkStep.workStepType, formData: {projectId: tcDirectProjectId}},
1919
cache: false,
2020
async: false,
2121
dataType: 'json',
@@ -45,7 +45,7 @@ $(document).ready(function() {
4545
$.ajax({
4646
type: 'POST',
4747
url: ctx + "/getSubmissionDataForPhase",
48-
data: {contestId: currentChallenge.id, phaseName: currentPhase.label, formData: {projectId: tcDirectProjectId}},
48+
data: {contestId: currentChallenge.id, phaseName: currentPhase.label, workStepName: currentWorkStep.workStepType, formData: {projectId: tcDirectProjectId}},
4949
cache: false,
5050
async: false,
5151
dataType: 'json',
@@ -104,8 +104,8 @@ $(document).ready(function() {
104104
modalPreloader();
105105
$.ajax({
106106
type: 'POST',
107-
url: ctx + "/getWorkStepDesignChallenges",
108-
data: {formData: {projectId: tcDirectProjectId}},
107+
url: ctx + "/getWorkStepChallenges",
108+
data: {formData: {projectId: tcDirectProjectId}, workStepName: currentWorkStep.workStepType},
109109
cache: false,
110110
async: false,
111111
dataType: 'json',

0 commit comments

Comments
 (0)