[Bug #1303] Fix issue removing consolidation using IntraDayDate for task end
Change type of ConsolidatedValue::taskEndDate to IntraDayDate to store too EffortDuration together with end date. FEA: ItEr75S04BugFixing
This commit is contained in:
parent
bdcd45abaa
commit
b7524bdce5
7 changed files with 49 additions and 22 deletions
|
|
@ -25,6 +25,7 @@ import java.math.BigDecimal;
|
|||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.util.deepcopy.DeepCopy;
|
||||
import org.libreplan.business.workingday.IntraDayDate;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
|
|
@ -39,12 +40,12 @@ public class CalculatedConsolidatedValue extends ConsolidatedValue {
|
|||
}
|
||||
|
||||
public static CalculatedConsolidatedValue create(LocalDate date,
|
||||
BigDecimal value, LocalDate taskEndDate) {
|
||||
BigDecimal value, IntraDayDate taskEndDate) {
|
||||
return create(new CalculatedConsolidatedValue(date, value, taskEndDate));
|
||||
}
|
||||
|
||||
protected CalculatedConsolidatedValue(LocalDate date, BigDecimal value,
|
||||
LocalDate taskEndDate) {
|
||||
IntraDayDate taskEndDate) {
|
||||
super(date, value, taskEndDate);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.math.BigDecimal;
|
|||
import org.hibernate.validator.NotNull;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.common.BaseEntity;
|
||||
import org.libreplan.business.workingday.IntraDayDate;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
|
|
@ -35,7 +36,7 @@ public abstract class ConsolidatedValue extends BaseEntity {
|
|||
|
||||
private LocalDate date;
|
||||
private BigDecimal value;
|
||||
private LocalDate taskEndDate;
|
||||
private IntraDayDate taskEndDate;
|
||||
|
||||
public abstract boolean isCalculated();
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ public abstract class ConsolidatedValue extends BaseEntity {
|
|||
}
|
||||
|
||||
protected ConsolidatedValue(LocalDate date, BigDecimal value,
|
||||
LocalDate taskEndDate) {
|
||||
IntraDayDate taskEndDate) {
|
||||
this.date = date;
|
||||
this.value = value;
|
||||
this.taskEndDate = taskEndDate;
|
||||
|
|
@ -67,7 +68,7 @@ public abstract class ConsolidatedValue extends BaseEntity {
|
|||
}
|
||||
|
||||
@NotNull(message = "task end date not specified")
|
||||
public LocalDate getTaskEndDate() {
|
||||
public IntraDayDate getTaskEndDate() {
|
||||
return taskEndDate;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.libreplan.business.advance.entities.AdvanceMeasurement;
|
|||
import org.libreplan.business.util.deepcopy.DeepCopy;
|
||||
import org.libreplan.business.util.deepcopy.OnCopy;
|
||||
import org.libreplan.business.util.deepcopy.Strategy;
|
||||
import org.libreplan.business.workingday.IntraDayDate;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
|
|
@ -45,26 +46,26 @@ public class NonCalculatedConsolidatedValue extends ConsolidatedValue {
|
|||
}
|
||||
|
||||
public static NonCalculatedConsolidatedValue create(LocalDate date,
|
||||
BigDecimal value, LocalDate taskEndDate) {
|
||||
BigDecimal value, IntraDayDate taskEndDate) {
|
||||
return create(new NonCalculatedConsolidatedValue(date, value,
|
||||
taskEndDate));
|
||||
}
|
||||
|
||||
public static NonCalculatedConsolidatedValue create(LocalDate date,
|
||||
BigDecimal value, AdvanceMeasurement advanceMeasurement,
|
||||
LocalDate taskEndDate) {
|
||||
IntraDayDate taskEndDate) {
|
||||
return create(new NonCalculatedConsolidatedValue(date, value,
|
||||
advanceMeasurement, taskEndDate));
|
||||
}
|
||||
|
||||
protected NonCalculatedConsolidatedValue(LocalDate date, BigDecimal value,
|
||||
AdvanceMeasurement advanceMeasurement, LocalDate taskEndDate) {
|
||||
AdvanceMeasurement advanceMeasurement, IntraDayDate taskEndDate) {
|
||||
this(date, value, taskEndDate);
|
||||
this.advanceMeasurement = advanceMeasurement;
|
||||
}
|
||||
|
||||
protected NonCalculatedConsolidatedValue(LocalDate date, BigDecimal value,
|
||||
LocalDate taskEndDate) {
|
||||
IntraDayDate taskEndDate) {
|
||||
super(date, value, taskEndDate);
|
||||
}
|
||||
|
||||
|
|
|
|||
20
libreplan-business/src/main/resources/db.changelog-1.2.xml
Normal file
20
libreplan-business/src/main/resources/db.changelog-1.2.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
|
||||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
|
||||
|
||||
<changeSet id="add-task_end_date_effort_duration-to-consolidated_value" author="mrego">
|
||||
<comment>
|
||||
taskEndDate attribute in class ConsolidatedValue has been changed to IntraDayDate.
|
||||
It is needed to add some columns to store EffortDuration in ConsolidatedValue.
|
||||
</comment>
|
||||
<addColumn tableName="consolidated_value">
|
||||
<column name="task_end_date_effort_duration" type="INTEGER" />
|
||||
</addColumn>
|
||||
<addDefaultValue tableName="consolidated_value"
|
||||
columnName="task_end_date_effort_duration"
|
||||
defaultValueNumeric="0" />
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
|
@ -9,5 +9,6 @@
|
|||
<include file="src/main/resources/db.changelog-initial.xml"/>
|
||||
<include file="src/main/resources/db.changelog-1.0.xml"/>
|
||||
<include file="src/main/resources/db.changelog-1.1.xml"/>
|
||||
<include file="src/main/resources/db.changelog-1.2.xml"/>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
|
|
|||
|
|
@ -13,8 +13,13 @@
|
|||
|
||||
<property name="date" access="field" type="org.joda.time.contrib.hibernate.PersistentLocalDate" />
|
||||
<property name="value" scale="2" access="field" />
|
||||
<property name="taskEndDate" access="field" type="org.joda.time.contrib.hibernate.PersistentLocalDate"
|
||||
column="task_end_date" />
|
||||
|
||||
<component name="taskEndDate" class="org.libreplan.business.workingday.IntraDayDate">
|
||||
<property name="date" column="task_end_date"
|
||||
type="org.joda.time.contrib.hibernate.PersistentLocalDate" />
|
||||
<property name="effortDuration" column="task_end_date_effort_duration"
|
||||
type="org.libreplan.business.workingday.hibernate.EffortDurationType"/>
|
||||
</component>
|
||||
|
||||
<subclass name="NonCalculatedConsolidatedValue" discriminator-value="non_calculated">
|
||||
<!-- Indexed -->
|
||||
|
|
|
|||
|
|
@ -279,16 +279,15 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
if (consolidation != null && task != null) {
|
||||
|
||||
if (consolidation.isCalculated()) {
|
||||
return CalculatedConsolidatedValue.create(LocalDate
|
||||
.fromDateFields(dto.getDate()), dto.getPercentage(),
|
||||
LocalDate.fromDateFields(task.getEndDate()));
|
||||
return CalculatedConsolidatedValue.create(
|
||||
LocalDate.fromDateFields(dto.getDate()),
|
||||
dto.getPercentage(), task.getIntraDayEndDate());
|
||||
} else {
|
||||
AdvanceMeasurement measure = dto.getAdvanceMeasurement();
|
||||
NonCalculatedConsolidatedValue consolidatedValue = NonCalculatedConsolidatedValue
|
||||
.create(LocalDate.fromDateFields(dto.getDate()), dto
|
||||
.getPercentage(), measure, LocalDate
|
||||
.fromDateFields(task
|
||||
.getEndDate()));
|
||||
.create(LocalDate.fromDateFields(dto.getDate()),
|
||||
dto.getPercentage(), measure,
|
||||
task.getIntraDayEndDate());
|
||||
measure.getNonCalculatedConsolidatedValues().add(
|
||||
consolidatedValue);
|
||||
return consolidatedValue;
|
||||
|
|
@ -304,10 +303,9 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
|
||||
if (!consolidation.getConsolidatedValues().isEmpty()) {
|
||||
LocalDate endExclusive = consolidation.getConsolidatedValues()
|
||||
.last()
|
||||
.getTaskEndDate();
|
||||
task.setEndDate(endExclusive.toDateTimeAtStartOfDay().toDate());
|
||||
IntraDayDate endExclusive = consolidation.getConsolidatedValues()
|
||||
.last().getTaskEndDate();
|
||||
task.setIntraDayEndDate(endExclusive);
|
||||
}
|
||||
if (!consolidation.isCalculated()) {
|
||||
((NonCalculatedConsolidation) consolidation)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue