Add a method to return division result as BigDecimal.
FEA: ItEr75S27PerProjectDashboard
This commit is contained in:
parent
2b3fb8c573
commit
b1f2c89589
1 changed files with 18 additions and 0 deletions
|
|
@ -266,6 +266,24 @@ public class EffortDuration implements Comparable<EffortDuration> {
|
|||
return Fraction.getFraction(this.seconds, effortAssigned.seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Divides this duration by other (using total seconds) returning the
|
||||
* quotient as BigDecimal.
|
||||
* </p>
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal dividedByAndResultAsBigDecimal(EffortDuration other) {
|
||||
if (other.isZero()) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
else {
|
||||
return new BigDecimal(this.getSeconds()).divide(
|
||||
new BigDecimal(other.getSeconds()), 8, BigDecimal.ROUND_HALF_EVEN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the remainder resulting of doing the integer division of both
|
||||
* durations
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue