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

Save Effort Estimate as hours and revert related db changes #444

Merged
merged 1 commit into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* </p>
*
* <p>
* Version 1.3.0 (Topcoder - Add effort days field)
* Version 1.3.0 (Topcoder - Add effort hours field)
* <ul>
* <li>Add {@link #EFFORT_HOURS_ESTIMATE}</li>
* </ul>
Expand Down Expand Up @@ -95,21 +95,21 @@ public class ProjectPropertyType implements Serializable {

/**
* Represents key for Allow Stock Art property.
*
*
* @since 1.2.1
*/
public static final String ALLOW_STOCK_ART_KEY = "Allow Stock Art";

/**
* Represents key for Viewable Submissions Flag property.
*
*
* @since 1.2.1
*/
public static final String VIEWABLE_SUBMISSIONS_FLAG_KEY_STRING = "Viewable Submissions Flag";

/**
* Represents key for Viewable Submitters property.
*
*
* @since 1.2.1
*/
public static final String VIEWABLE_SUBMITTERS_KEY = "Viewable Submitters";
Expand Down Expand Up @@ -184,7 +184,7 @@ public class ProjectPropertyType implements Serializable {
*/
public static final String BILLING_PROJECT_PROJECT_PROPERTY_KEY = "Billing Project";


/**
* <p>
* Represents the "confidentiality type" project property key
Expand Down Expand Up @@ -217,7 +217,7 @@ public class ProjectPropertyType implements Serializable {
*
*/
public static final String PUBLIC_PROJECT_PROPERTY_KEY = "Public";

/**
* Represents the "Rated" project property key
*
Expand Down Expand Up @@ -289,7 +289,7 @@ public class ProjectPropertyType implements Serializable {
*/
public static final String ROOT_CATALOG_ID_PROJECT_PROPERTY_KEY = "Root Catalog ID";


/**
* Represents the "Approval Required" project property key
*
Expand Down Expand Up @@ -338,13 +338,13 @@ public class ProjectPropertyType implements Serializable {
*
*/
public static final String COPILOT_COST_PROJECT_PROPERTY_KEY = "Copilot Cost";

/**
* Represents the "Contest Fee Percentage" project property key
*
*/
public static final String CONTEST_FEE_PERCENTAGE_PROJECT_PROPERTY_KEY = "Contest Fee Percentage";

/**
* Represents the "Review Feedback Flag" project property key
*
Expand Down Expand Up @@ -372,7 +372,7 @@ public class ProjectPropertyType implements Serializable {
*/
public static final String ALLOW_MULTIPLE_SUBMISSIONS_PROPERTY_KEY = "Allow multiple submissions";


/**
* Represents the "CloudSpokes CMC Task" project property key.
*
Expand Down Expand Up @@ -437,9 +437,9 @@ public class ProjectPropertyType implements Serializable {
public static final String REVIEW_TYPE_KEY = "Review Type";

/*
* Represent "Effort Days Estimate" key
* Represent "Effort Hours Estimate" key
*/
public static final String EFFORT_HOURS_ESTIMATE = "Effort Days Estimate";
public static final String EFFORT_HOURS_ESTIMATE = "Effort Hours Estimate";

/**
* Represents the id of this instance. Only values greater than zero is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
* </p>
*
* <p>
* Version 1.3 (TC - Add effort days field)
* - Add enable effort days field for client
* Version 1.3 (TC - Add effort hours field)
* - Add enable effort hours field for client
* </p>
*
* <p>
Expand Down Expand Up @@ -124,7 +124,7 @@ public class ProjectDAOBean extends GenericEJB3DAO<Project, Long> implements
private static final String SELECT_PROJECT = "select p.project_id, p.name, p.po_box_number, p.description, "
+ " p.active, p.sales_tax, p.payment_terms_id, p.modification_user, p.modification_date, "
+ " p.creation_date, p.creation_user, p.is_deleted, "
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name, c.enable_effort_days "
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name, c.enable_effort_hours "
+ " from project as p left join client_project as cp on p.project_id = cp.project_id left join client c "
+ " on c.client_id = cp.client_id and (c.is_deleted = 0 or c.is_deleted is null) "
+ " where p.active = 1 and p.start_date <= current and current <= p.end_date ";
Expand All @@ -135,7 +135,7 @@ public class ProjectDAOBean extends GenericEJB3DAO<Project, Long> implements
private static final String SELECT_PROJECT_BY_CLIENT_ID = "select p.project_id, p.name, p.po_box_number, p.description, "
+ " p.active, p.sales_tax, p.payment_terms_id, p.modification_user, p.modification_date, "
+ " p.creation_date, p.creation_user, p.is_deleted, "
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name, c.enable_effort_days "
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name, c.enable_effort_hours "
+ " from project as p, client_project as cp, client as c "
+ " where p.start_date <= current and current <= p.end_date "
+ " and c.client_id = cp.client_id and (p.is_deleted = 0 or p.is_deleted is null) "
Expand All @@ -154,8 +154,8 @@ public class ProjectDAOBean extends GenericEJB3DAO<Project, Long> implements
+ " where p.start_date <= current and current <= p.end_date "
+ " and c.client_id = cp.client_id and (p.is_deleted = 0 or p.is_deleted is null) "
+ " and p.project_id = cp.project_id ";


/**
* The query string used to select project by project id.
*
Expand Down Expand Up @@ -499,8 +499,8 @@ private List<Project> convertQueryToListProjects(Query query) {
}

if (os[16] != null) {
int enableEffortDays = Integer.parseInt(os[16].toString());
client.setEnableEffortDays(enableEffortDays == 1 ? true : false);
int enableEffortHours = Integer.parseInt(os[16].toString());
client.setEnableEffortHours(enableEffortHours == 1 ? true : false);
}

result.add(c);
Expand Down Expand Up @@ -957,13 +957,13 @@ public List<Project> getProjectsByIds(List<Long> projectIds) throws DAOException
}

EntityManager entityManager = Helper.checkEntityManager(getEntityManager());

StringBuilder projectIdsClause = new StringBuilder();

projectIdsClause.append(" (");

boolean first = true;

for(int i = 0; i < projectIds.size(); ++i) {
if(projectIds.get(i) != null) {

Expand All @@ -978,11 +978,11 @@ public List<Project> getProjectsByIds(List<Long> projectIds) throws DAOException
}

projectIdsClause.append(")");


try {
String queryString = SELECT_PROJECTS_BY_IDS + projectIdsClause.toString();

System.out.println(queryString);

Query query = entityManager.createNativeQuery(queryString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,24 @@ public class Client extends AuditableEntity {

/**
* <p>
* This field represents the 'enableEffortDays' property of the Client.
* This field represents the 'enableEffortHours' property of the Client.
* </p>
* <p>
* It is default to the default value of this data type when it is not
* assigned.
* </p>
* <p>
* Through corresponding getter/setter methods. It is retrieved from
* Client.enableEffortDays [Client.isEffortDaysEnabled()] and in table
* client.enable_effort_days.
* Client.enableEffortHours [Client.isEffortHoursEnabled()] and in table
* client.enable_effort_hours.
* </p>
* <p>
* There are no restrictions at this moment. It can take any value.
* OPTIONAL.
* </p>
*/
@Column(name = "enable_effort_days")
private Boolean enableEffortDays;
@Column(name = "enable_effort_hours")
private Boolean enableEffortHours;

/**
* <p>
Expand Down Expand Up @@ -377,21 +377,21 @@ public void setStartDate(Date startDate) {
}

/**
* Gets whether this client enabled effort days.
* Gets whether this client enabled effort hours.
*
* @return whether this client enabled effort days.
* @return whether this client enabled effort hours.
*/
public Boolean isEffortDaysEnabled() {
return this.enableEffortDays;
public Boolean isEffortHoursEnabled() {
return this.enableEffortHours;
}

/**
* Sets whether this client enabled effort days.
* Sets whether this client enabled effort hours.
*
* @param enableEffortDays
* whether this client enabled effort days.
* @param enableEffortHours
* whether this client enabled effort hours.
*/
public void setEnableEffortDays(Boolean enableEffortDays) {
this.enableEffortDays = enableEffortDays;
public void setEnableEffortHours(Boolean enableEffortHours) {
this.enableEffortHours = enableEffortHours;
}
}
Loading