ItEr24S08CUAsignacionGrupoRecursosAPlanificacionItEr23S10: [FixBug] Increase scale precision for percentage
Check percentage is not null when rendering and summing up percentages
This commit is contained in:
parent
a4f19c2dec
commit
038cabac16
3 changed files with 8 additions and 4 deletions
|
|
@ -12,7 +12,7 @@
|
|||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="percentage" />
|
||||
<property name="percentage" type="java.math.BigDecimal" scale="8"/>
|
||||
|
||||
<many-to-one class="Task" name="task" column="TASK" />
|
||||
|
||||
|
|
|
|||
|
|
@ -307,6 +307,8 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
// Set percentage
|
||||
BigDecimal percentage = resourceAllocation.getPercentage();
|
||||
if (!new BigDecimal(0).equals(resourceAllocation.getPercentage())) {
|
||||
percentage = (percentage != null) ? percentage
|
||||
: new BigDecimal(0);
|
||||
percentage = percentage.scaleByPowerOfTen(2).setScale(2,
|
||||
BigDecimal.ROUND_CEILING);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,9 +237,11 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
BigDecimal result = new BigDecimal(0);
|
||||
|
||||
for (Iterator i = resourceAllocations.iterator(); i.hasNext();) {
|
||||
ResourceAllocation resourceAllocation = (ResourceAllocation) i
|
||||
.next();
|
||||
result = result.add(resourceAllocation.getPercentage());
|
||||
ResourceAllocation resourceAllocation = (ResourceAllocation) i.next();
|
||||
BigDecimal percentage = (resourceAllocation.getPercentage() != null) ? resourceAllocation
|
||||
.getPercentage()
|
||||
: new BigDecimal(0);
|
||||
result = result.add(percentage);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue