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

Fix For Null Case Of Enable Effort Hours Configuration #433

Merged
merged 10 commits into from
Jul 9, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class Client extends AuditableEntity {
* </p>
*/
@Column(name = "enable_effort_hours")
private boolean enableEffortHours;
private Boolean enableEffortHours;

/**
* <p>
Expand Down Expand Up @@ -381,7 +381,7 @@ public void setStartDate(Date startDate) {
*
* @return whether this client enabled effort hours.
*/
public boolean isEffortHoursEnabled() {
public Boolean isEffortHoursEnabled() {
return this.enableEffortHours;
}

Expand All @@ -391,7 +391,7 @@ public boolean isEffortHoursEnabled() {
* @param enableEffortHours
* whether this client enabled effort hours.
*/
public void setEnableEffortHours(boolean enableEffortHours) {
public void setEnableEffortHours(Boolean enableEffortHours) {
this.enableEffortHours = enableEffortHours;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2470,45 +2470,45 @@ private SoftwareContestPaymentResult processContestSaleInternal(TCSubject tcSubj
if (competition.getProjectHeader().getProjectCategory().getProjectType().getId() != ProjectType.STUDIO.getId()) {
// software competition
if (contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.FIRST_PLACE_COST_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.FIRST_PLACE_COST_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.FIRST_PLACE_COST_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.FIRST_PLACE_COST_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.FIRST_PLACE_COST_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.SECOND_PLACE_COST_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.SECOND_PLACE_COST_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.SECOND_PLACE_COST_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.SECOND_PLACE_COST_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.SECOND_PLACE_COST_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.CHECKPOINT_BONUS_COST_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.CHECKPOINT_BONUS_COST_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.CHECKPOINT_BONUS_COST_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.CHECKPOINT_BONUS_COST_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.CHECKPOINT_BONUS_COST_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.RELIABILITY_BONUS_COST_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.RELIABILITY_BONUS_COST_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.RELIABILITY_BONUS_COST_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.RELIABILITY_BONUS_COST_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.RELIABILITY_BONUS_COST_PROJECT_PROPERTY_KEY));
}

// checkpoint prizes
Expand All @@ -2523,21 +2523,21 @@ private SoftwareContestPaymentResult processContestSaleInternal(TCSubject tcSubj
// studio competition

if (contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.SPEC_REVIEW_COSTS_PROJECT_PROPERTY_KEY));
}

if (contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY) != null
&& !((String)contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
&& !(contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY)).equals(""))
{
totalFee += Double.parseDouble((String) contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY));
totalFee += Double.parseDouble(contest.getProperty(ProjectPropertyType.REVIEW_COSTS_PROJECT_PROPERTY_KEY));
}

for (Prize prize : competition.getProjectHeader().getPrizes()) {
Expand Down Expand Up @@ -2567,7 +2567,10 @@ private SoftwareContestPaymentResult processContestSaleInternal(TCSubject tcSubj
double totalCost = totalFee;
double totalMemberCost = totalFee;

totalMemberCost = totalMemberCost - Double.parseDouble((String) contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY));
String adminFee = contest.getProperty(ProjectPropertyType.ADMIN_FEE_PROJECT_PROPERTY_KEY);
if (adminFee != null && adminFee.trim().length() != 0) {
totalMemberCost = totalMemberCost - Double.parseDouble(adminFee);
}

if (paymentData instanceof TCPurhcaseOrderPaymentData) {

Expand Down Expand Up @@ -5956,7 +5959,7 @@ public SoftwareCompetition getSoftwareContestByProjectId(TCSubject tcSubject, lo
try {
Client client = projectService.getClientByProject(fullProjectData.getProjectHeader().getTcDirectProjectId());
if (client != null) {
effortHoursEnabled = client.isEffortHoursEnabled();
effortHoursEnabled = client.isEffortHoursEnabled() == null ? false : client.isEffortHoursEnabled();
}

} catch (PersistenceFault e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
* Changes in v1.4.4 (TC Direct Release Assembly 7)
* - add method updateContestSale for updating contest sale.
* </p>
*
*
* <p>
* Version 1.4.4 (TC Direct Replatforming Release 1) Change notes:
* <ul>
Expand All @@ -258,7 +258,7 @@
* <li>Add {@link #getAllFileTypes()} method.</li>
* </ul>
* </p>
*
*
* <p>
* Version 1.4.5 (TC Direct Replatforming Release 2) Change notes:
* <ul>
Expand Down Expand Up @@ -315,7 +315,7 @@
* software checkpoint management.
* </li></ol>
* </p>
*
*
* <p>
* Version 1.4.10 (Release Assembly - TC Direct Issue Tracking Tab Update Assembly 2 v1.0) change notes:
* <ol>
Expand All @@ -327,7 +327,7 @@
* Version 1.4.11 (Module Assembly - TC Cockpit - Studio - Final Fixes Integration Part One Assembly) Change notes:
* <ol>
* <li>Added {@link #getReviewsByPhase(long, long)} method.</li>
* <li>Updated {@link #updateProject(Project, String, com.topcoder.project.phases.Project, Resource[], Date, String)}
* <li>Updated {@link #updateProject(Project, String, com.topcoder.project.phases.Project, Resource[], Date, String)}
* and {@link #createProjectWithTemplate(Project, com.topcoder.project.phases.Project, Resource[], String)} methods
* to properly maintain the Approval phase for Studio contests.</li>
* </ol>
Expand Down Expand Up @@ -442,9 +442,9 @@
* </p>
*
* <p>
* Version 2.6 (Topcoder - Add effort hours field)
* Version 2.6 (Topcoder - Add effort days field)
* <ul>
* <li>Add enable effort hours</li>
* <li>Add enable effort days</li>
* </ul>
* </p>
*
Expand Down Expand Up @@ -1839,7 +1839,7 @@ public FullProjectData updateProject(Project projectHeader, String projectHeader
* @since 1.4.7
*/
public FullProjectData updateProject(Project projectHeader, String projectHeaderReason,
com.topcoder.project.phases.Project projectPhases, Resource[] projectResources,
com.topcoder.project.phases.Project projectPhases, Resource[] projectResources,
Date regEndDate, Date multiRoundEndDate, Date endDate, String operator) {
Util.log(logger, Level.INFO, "Enters ProjectServicesImpl#updateProject method.");

Expand Down Expand Up @@ -2790,7 +2790,7 @@ public FullProjectData createProjectWithTemplate(Project projectHeader, com.topc
if (regEndDate != null) {
adjustPhaseForEndDate(PhaseType.REGISTRATION_PHASE, newProjectPhases, regEndDate);
}

if (multiRoundEndDate != null) {
// multiround phase duration
adjustPhaseForEndDate(PhaseType.CHECKPOINT_SUBMISSION_PHASE, newProjectPhases, multiRoundEndDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ public String getBillingAccountsForProject() {
billingAccount.put("cca", String.valueOf(requireCCAs[i]));
// Add enableEffortHours for each billing account
Client client = billingAccountsByProject.get(i).getClient();
if (client != null) {
billingAccount.put("enableEffortHours", client.isEffortHoursEnabled());
if (client != null && client.isEffortHoursEnabled() != null) {
billingAccount.put("enableEffortHours", String.valueOf(client.isEffortHoursEnabled()));
} else {
billingAccount.put("enableEffortHours", false);
billingAccount.put("enableEffortHours", "false");
}

result.add(billingAccount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,10 @@ protected void executeAction() throws Exception {
billingAccount.put("cca", String.valueOf(requireCCAs[i]));
// Add enableEffortHours for each billing account
Client client = billingProjects.get(i).getClient();
if (client != null) {
billingAccount.put("enableEffortHours", client.isEffortHoursEnabled());
if (client != null && client.isEffortHoursEnabled() != null) {
billingAccount.put("enableEffortHours", String.valueOf(client.isEffortHoursEnabled()));
} else {
billingAccount.put("enableEffortHours", false);
billingAccount.put("enableEffortHours", "false");
}
billingAccountsForProject.add(billingAccount);
}
Expand Down
6 changes: 3 additions & 3 deletions src/web/WEB-INF/contest-details2.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
billingAccounts.push({"id": "<s:property value="id" />",
"name" : "<s:property value="name" />",
"cca" : "<s:property value="cca" />",
"enableEffortHours" : "<s:property value="enableEffortHours" />"
"enableEffortDays" : "<s:property value="enableEffortHours" />"
});
</s:iterator>
</script>
Expand Down Expand Up @@ -172,7 +172,7 @@
</div>
<!-- End #wrapper -->
<div class="tooltipArea">
<div id="effortHourToolTip" class="tooltipContainer">
<div id="effortDaysToolTip" class="tooltipContainer">
<span class="arrow"></span>
<div class="tooltipLeft"><div class="tooltipRight"><div class="tooltipBottom">
<div class="tooltipBottomLeft"><div class="tooltipBottomRight">
Expand All @@ -187,7 +187,7 @@
</div><!-- End .tooltipCaption -->

<div class="tooltipContent">
<p>in Equated <strong>offshore hours = onsite hours * 6 + offshore hours</strong></p>
<p>onsite efforts in person days * 6 + offshore efforts in person days</p>
</div><!-- End .tooltipContent -->

</div></div>
Expand Down
18 changes: 10 additions & 8 deletions src/web/WEB-INF/includes/contest/editTab.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
</tr>
<tr></tr>
<tr class="effortEstimateRow hide">
<td class="first_tab_type"><strong>Effort Hours Estimate</strong></td>
<td class="sec_tab_type"><strong>: <span id="rEffortHoursEstimate"></span></strong></td>
<td class="first_tab_type"><strong>Estimated Effort<br/>(in Person Days):</strong></td>
<td class="sec_tab_type"><strong>: <span id="rEffortDaysEstimate"></span></strong></td>
</tr>
<tr></tr>
<tr>
Expand Down Expand Up @@ -342,18 +342,20 @@
</div>
<br/><br/>
<div class="effortEstimateRow">
<span class="name fixWidthName" title="Enter effort hours estimate"><strong>Estimated Effort:&nbsp;</strong><a href="javascript:;" class="helpme"><img src="/images/help_ico5.gif" alt="help"/></a></span>
<input id="effortHoursEstimate" class="bigin" name="effortHoursEstimate" type="text" value="" />
<span class="name fixWidthName" title="Enter effort days estimate"><strong>Estimated Effort<br/>(in Person Days):&nbsp;</strong><a href="javascript:;" class="helpme"><img src="/images/help_ico5.gif" alt="help"/></a></span>
<input id="effortDaysEstimate" class="bigin" name="effortDaysEstimate" type="text" value="" />
</div>
<br/><br/>
<span class="name fixWidthName"><strong>Created By</strong></span>
<span class ='small_info_spec' id="challegneCreatorLabel"></span>
<div>
<p class="save">
<a href="javascript:;" class="cancel_text">cancel</a>
<a href="javascript:;"><img src="/images/save_change.png" alt="save" class="save_btn" /></a>
</p>
</div>
</div>
</div>
<p class="save">
<a href="javascript:;" class="cancel_text">cancel</a>
<a href="javascript:;"><img src="/images/save_change.png" alt="save" class="save_btn" /></a>
</p>
<div class="clear"></div>
</div><!-- End .detailsContent -->
</div><!-- End .details -->
Expand Down
8 changes: 4 additions & 4 deletions src/web/WEB-INF/includes/contest/editTabMarathon.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
</tr>
<tr></tr>
<tr class="effortEstimateRow hide">
<td class="first_tab_type"><strong>Effort Hours Estimate</strong></td>
<td class="sec_tab_type"><strong>: <span id="rEffortHoursEstimate"></span></strong></td>
<td class="first_tab_type"><strong>Estimated Effort<br/>(in Person Days):</strong></td>
<td class="sec_tab_type"><strong>: <span id="rEffortDaysEstimate"></span></strong></td>
</tr>
<tr></tr>
<tr>
Expand Down Expand Up @@ -295,8 +295,8 @@
</div>
<br /><br />
<div class="effortEstimateRow">
<span class="name fixWidthName" title="Enter effort hours estimate"><strong>Estimated Effort:&nbsp;</strong><a href="javascript:;" class="helpme"><img src="/images/help_ico5.gif" alt="help"/></a></span>
<input id="effortHoursEstimate" class="bigin" name="effortHoursEstimate" type="text" value="" />
<span class="name fixWidthName" title="Enter effort days estimate"><strong>Estimated Effort<br/>(in Person Days):&nbsp;</strong><a href="javascript:;" class="helpme"><img src="/images/help_ico5.gif" alt="help"/></a></span>
<input id="effortDaysEstimate" class="bigin" name="effortDaysEstimate" type="text" value="" />
</div>
<br/><br/>
<span class="name fixWidthName"><strong>Created By</strong></span>
Expand Down
12 changes: 6 additions & 6 deletions src/web/WEB-INF/includes/contest/editTabSoftware.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
- Version 3.3 (Topcoder - Support Points Prize Type For Challenges):
- - Add "Points" section.
-
- Version 3.4 (Topcoder - Add effort hours field):
- - Add enable effort hours
- Version 3.4 (Topcoder - Add effort days field):
- - Add enable effort days
--%>
<%@ include file="/WEB-INF/includes/taglibs.jsp" %>

Expand Down Expand Up @@ -185,8 +185,8 @@
</tr>
<tr></tr>
<tr class="effortEstimateRow hide">
<td class="first_tab_type"><strong>Effort Hours Estimate</strong></td>
<td class="sec_tab_type"><strong>: <span id="rEffortHoursEstimate"></span></strong></td>
<td class="first_tab_type"><strong>Estimated Effort<br/>(in Person Days):</strong></td>
<td class="sec_tab_type"><strong>: <span id="rEffortDaysEstimate"></span></strong></td>
</tr>
<tr></tr>
<tr>
Expand Down Expand Up @@ -369,8 +369,8 @@
<br/>

<div class="effortEstimateRow">
<span class="name fixWidthName" title="Enter effort hours estimate"><strong>Estimated Effort:&nbsp;</strong><a href="javascript:;" class="helpme"><img src="/images/help_ico5.gif" alt="help"/></a></span>
<input id="effortHoursEstimate" class="bigin" name="effortHoursEstimate" type="text" value="" />
<span class="name fixWidthName" title="Enter effort days estimate"><strong>Estimated Effort<br/>(in Person Days):&nbsp;</strong><a href="javascript:;" class="helpme"><img src="/images/help_ico5.gif" alt="help"/></a></span>
<input id="effortDaysEstimate" class="bigin" name="effortDaysEstimate" type="text" value="" />
<br/>
<br/>
<br/>
Expand Down
Loading