Examples of toHoursAsDecimalWithScale()


Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

    }

    @Test
    public void canConvertToDecimalHours() {
        EffortDuration duration = hours(1).and(30, Granularity.MINUTES);
        assertThat(duration.toHoursAsDecimalWithScale(1), equalTo(new BigDecimal("1.5")));
    }

    @Test
    public void theScaleIsTheOneProvided() {
        EffortDuration duration = hours(1).and(30, Granularity.MINUTES);
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

    }

    @Test
    public void theScaleIsTheOneProvided() {
        EffortDuration duration = hours(1).and(30, Granularity.MINUTES);
        assertThat(duration.toHoursAsDecimalWithScale(1).scale(), equalTo(1));
        assertThat(duration.toHoursAsDecimalWithScale(2).scale(), equalTo(2));
        assertThat(duration.toHoursAsDecimalWithScale(3).scale(), equalTo(3));
    }

    @Test
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

    @Test
    public void theScaleIsTheOneProvided() {
        EffortDuration duration = hours(1).and(30, Granularity.MINUTES);
        assertThat(duration.toHoursAsDecimalWithScale(1).scale(), equalTo(1));
        assertThat(duration.toHoursAsDecimalWithScale(2).scale(), equalTo(2));
        assertThat(duration.toHoursAsDecimalWithScale(3).scale(), equalTo(3));
    }

    @Test
    public void anHalfUpRoundIsDone() {
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

    @Test
    public void theScaleIsTheOneProvided() {
        EffortDuration duration = hours(1).and(30, Granularity.MINUTES);
        assertThat(duration.toHoursAsDecimalWithScale(1).scale(), equalTo(1));
        assertThat(duration.toHoursAsDecimalWithScale(2).scale(), equalTo(2));
        assertThat(duration.toHoursAsDecimalWithScale(3).scale(), equalTo(3));
    }

    @Test
    public void anHalfUpRoundIsDone() {
        // 3601/3600 = 1.000277778
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

    @Test
    public void anHalfUpRoundIsDone() {
        // 3601/3600 = 1.000277778
        EffortDuration duration = hours(1).and(1, Granularity.SECONDS);
        assertThat(duration.toHoursAsDecimalWithScale(6), equalTo(new BigDecimal(
                "1.000278")));
        assertThat(duration.toHoursAsDecimalWithScale(5),
                equalTo(new BigDecimal("1.00028")));
        assertThat(duration.toHoursAsDecimalWithScale(4),
                equalTo(new BigDecimal("1.0003")));
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

    public void anHalfUpRoundIsDone() {
        // 3601/3600 = 1.000277778
        EffortDuration duration = hours(1).and(1, Granularity.SECONDS);
        assertThat(duration.toHoursAsDecimalWithScale(6), equalTo(new BigDecimal(
                "1.000278")));
        assertThat(duration.toHoursAsDecimalWithScale(5),
                equalTo(new BigDecimal("1.00028")));
        assertThat(duration.toHoursAsDecimalWithScale(4),
                equalTo(new BigDecimal("1.0003")));
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

        EffortDuration duration = hours(1).and(1, Granularity.SECONDS);
        assertThat(duration.toHoursAsDecimalWithScale(6), equalTo(new BigDecimal(
                "1.000278")));
        assertThat(duration.toHoursAsDecimalWithScale(5),
                equalTo(new BigDecimal("1.00028")));
        assertThat(duration.toHoursAsDecimalWithScale(4),
                equalTo(new BigDecimal("1.0003")));
    }

    @Test
    public void theDurationCanBeRoundedToIntegerHours() {
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration.toHoursAsDecimalWithScale()

    public BigDecimal getHoursAdvancePercentage(OrderElement orderElement) {
        final EffortDuration totalChargedEffort = orderElement
                .getSumChargedEffort() != null ? orderElement
                .getSumChargedEffort().getTotalChargedEffort() : EffortDuration
                .zero();
        BigDecimal assignedHours = totalChargedEffort
                .toHoursAsDecimalWithScale(2);
        BigDecimal estimatedHours = new BigDecimal(orderElement.getWorkHours())
                .setScale(2);

        if (estimatedHours.compareTo(BigDecimal.ZERO) <= 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.