DailyBalance dailyBalance = workSchedule.calculateWorkingPeriods(day, firstClockingDate,
DateTime lastClockingDate = null; if (clockings.size() != 0) { lastClockingDate = (clockings.get(clockings.size() - 1)).getDate(); } DailyBalance dailyBalance = workSchedule.calculateWorkingPeriods(day, firstClockingDate, lastClockingDate,
    public DailyBalance calculateDailyBalance(YearMonthDay day) {        WorkSchedule workSchedule = getSchedule(day).workScheduleWithDate(day);        Timeline timeline = new Timeline(workSchedule.getWorkScheduleType());        Iterator<AttributeType> attributesIt = DomainConstants.WORKED_ATTRIBUTES.getAttributes()                .iterator();        List<Leave> leaves = getLeaves(day, day);        Collections.sort(leaves, new BeanComparator("date"));        Leave.plotListInTimeline(leaves, attributesIt, timeline);        DateTime init = day.toDateTime(workSchedule.getWorkScheduleType().getWorkTime());        DateTime end = day.toDateTime(workSchedule.getWorkScheduleType().getWorkEndTime());        if (workSchedule.getWorkScheduleType().isNextDay()) {            end = end.plusDays(1);        }        List<AssiduousnessRecord> clockings = getClockingsAndMissingClockings(init, end);        Collections.sort(clockings, new BeanComparator("date"));        // for (AssiduousnessRecord assiduousnessRecord : clockings) {        // assiduousnessRecord.setDate(assiduousnessRecord.getDate().minusSeconds(        // assiduousnessRecord.getDate().getSecondOfMinute()));        // }        timeline.plotListInTimeline(clockings, attributesIt, day);        timeline.print();        DateTime firstClockingDate = null;        if (clockings.size() != 0) {            firstClockingDate = (clockings.iterator().next()).getDate();        }        DailyBalance dailyBalance = workSchedule.calculateWorkingPeriods(day, firstClockingDate,                timeline);        return dailyBalance;    }