Examples of EffortDuration


Examples of org.libreplan.business.workingday.EffortDuration

    @Test
    public void equalsAndHashCodeWorkOk() {
        LocalDate today = new LocalDate();
        LocalDate tomorrow = today.plusDays(1);
        EffortDuration oneHour = EffortDuration.hours(1);
        EffortDuration halfHour = EffortDuration.minutes(30);
        assertEquals(IntraDayDate.create(today, halfHour),
                IntraDayDate.create(tomorrow.minusDays(1), halfHour));
        assertEquals(IntraDayDate.create(today, halfHour).hashCode(), IntraDayDate
                .create(tomorrow.minusDays(1), halfHour).hashCode());
        assertThat(IntraDayDate.create(today, halfHour),
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    @Test
    public void theAmountOfTheIncreaseDependsOnTheAmountOfResourcesPerDay() {
        LocalDate today = new LocalDate();
        IntraDayDate intraDate = IntraDayDate.startOfDay(today);

        EffortDuration effort = hours(6);

        ResourcesPerDay half = ResourcesPerDay.amount(new BigDecimal(BigInteger
                .valueOf(5), 1));
        ResourcesPerDay oneQuarter = ResourcesPerDay.amount(new BigDecimal(
                BigInteger.valueOf(25), 2));
        ResourcesPerDay[] resourcesPerDays = { ResourcesPerDay.amount(2),
                ResourcesPerDay.amount(3), half, oneQuarter,
                ResourcesPerDay.amount(4) };

        EffortDuration[] ends = { hours(3), hours(2), hours(12), hours(24),
                hours(1).and(30, Granularity.MINUTES) };

        for (int i = 0; i < resourcesPerDays.length; i++) {
            ResourcesPerDay r = resourcesPerDays[i];
            EffortDuration end = ends[i];
            IntraDayDate newDay = intraDate.increaseBy(r, effort);

            assertThat(newDay.getDate(), equalTo(today));
            assertThat(newDay.getEffortDuration(), equalTo(end));
        }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

        return EffortDuration.parseFromFormattedString(effort);
    }

    public void updateSummary() {
        EffortDuration total = getEffortDurationFromTextbox(getTotalTextboxId());
        EffortDuration other = EffortDuration.zero();
        if (personalTimesheetModel.hasOtherReports()) {
            other = getEffortDurationFromTextbox(getTotalOtherTextboxId());
        }
        EffortDuration capacity = getEffortDurationFromTextbox(getTotalCapacityTextboxId());
        EffortDuration extraPerDay = getEffortDurationFromTextbox(getTotalExtraTextboxId());

        EffortDuration timesheet = total.minus(other);
        EffortDuration extra = EffortDuration.zero();
        if (total.compareTo(capacity) > 0) {
            extra = total.minus(capacity);
        }

        if (personalTimesheetModel.hasOtherReports()) {
            summaryTotalPersonalTimesheet
                    .setValue(timesheet.toFormattedString());
            summaryTotalOther.setValue(other.toFormattedString());
        }

        summaryTotal.setValue(total.toFormattedString());
        summaryTotalCapacity.setValue(capacity.toFormattedString());
        summaryTotalExtraPerDay.setValue(extraPerDay.toFormattedString());
        summaryTotalExtra.setValue(extra.toFormattedString());
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    @Test
    @Transactional
    public void theoreticalHoursIsTotalIfDateIsLaterThanEndDate() {
        prepareTaskForTheoreticalAdvanceTesting();
        EffortDuration totalAllocatedTime = AggregateOfDayAssignments.create(
                task.getDayAssignments(FilterType.KEEP_ALL)).getTotalTime();
        assertThat(task.getTheoreticalCompletedTimeUntilDate(task.getEndDate()), equalTo(totalAllocatedTime));

    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    @Test
    @Transactional
    public void theoreticalHoursWithADateWithinStartAndEndDateHead() {
        prepareTaskForTheoreticalAdvanceTesting();
        LocalDate limit = task.getStartAsLocalDate().plusDays(1);
        EffortDuration expected = EffortDuration.hours(8);
        assertThat(task.getTheoreticalCompletedTimeUntilDate(limit.toDateTimeAtStartOfDay().toDate()),
                equalTo(expected));
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    @Test
    @Transactional
    public void theoreticalHoursWithADateWithinStartAndEndDateTail() {
        prepareTaskForTheoreticalAdvanceTesting();
        LocalDate limit = task.getEndAsLocalDate().minusDays(1);
        EffortDuration expected = EffortDuration.hours(32);
        assertThat(task.getTheoreticalCompletedTimeUntilDate(limit.toDateTimeAtStartOfDay().toDate()),
                equalTo(expected));
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    @Override
    @Transactional(readOnly = true)
    public EffortDuration getAssignedDirectEffort(OrderElement orderElement) {
        List<WorkReportLine> listWRL = this.workReportLineDAO
                .findByOrderElement(orderElement);
        EffortDuration asignedDirectHours = EffortDuration.zero();
        Iterator<WorkReportLine> iterator = listWRL.iterator();
        while (iterator.hasNext()) {
            asignedDirectHours = asignedDirectHours.plus(iterator.next()
                    .getEffort());
        }
        return asignedDirectHours;
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    }

    @Override
    @Transactional(readOnly = true)
    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

Examples of org.libreplan.business.workingday.EffortDuration

        return average(new BigDecimal(list.size()), sum);
    }

    public EffortDuration calculateAverageWorkedHours(
            final List<OrderElement> list) {
        EffortDuration sum = sumWorkedHours(list);
        return (list.size() == 0) ? EffortDuration.zero() : EffortDuration
                .average(sum, list.size());
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

        }
        return sum;
    }

    private EffortDuration sumWorkedHours(final List<OrderElement> list) {
        EffortDuration sum = EffortDuration.zero();
        for (OrderElement orderElement : list) {
            sum = sum.plus(getAssignedDirectEffort(orderElement));
        }
        return sum;
    }
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.