protected List<TimeSeriesDataItem> getScopeSeriesDataItems(
      IterationHistoryEntry yesterdayEntry, IterationHistoryEntry todayEntry) {

    // Second item is places 2 seconds after the first
    // Resulting in a almost vertical line in the graph
    // Null value is added to break the line
    Second firstItemPeriod =
        new Second(
            todayEntry
                .getTimestamp()
                .toDateTimeAtCurrentTime()
                .minusMinutes(timeDifferenceMinutes)
                .toDateMidnight()
                .toDate());
    Second secondItemPeriod =
        new Second(
            todayEntry
                .getTimestamp()
                .toDateTimeAtCurrentTime()
                .minusMinutes(timeDifferenceMinutes)
                .toDateMidnight()
                .toDateTime()
                .plusSeconds(2)
                .toDate());
    Second nullItemPeriod =
        new Second(
            todayEntry
                .getTimestamp()
                .toDateTimeAtCurrentTime()
                .minusMinutes(timeDifferenceMinutes)
                .toDateMidnight()
                .toDateTime()
                .plusSeconds(3)
                .toDate());

    ExactEstimate firstValue = new ExactEstimate(yesterdayEntry.getEffortLeftSum());
    long secondValueAsLong =
        yesterdayEntry.getEffortLeftSum() + todayEntry.getDeltaOriginalEstimate();
    ExactEstimate secondValue = new ExactEstimate(secondValueAsLong);

    TimeSeriesDataItem firstItem =
        new TimeSeriesDataItem(firstItemPeriod, ExactEstimateUtils.extractMajorUnits(firstValue));
    TimeSeriesDataItem secondItem =
        new TimeSeriesDataItem(secondItemPeriod, ExactEstimateUtils.extractMajorUnits(secondValue));
    TimeSeriesDataItem nullItem = new TimeSeriesDataItem(nullItemPeriod, null);

    return Arrays.asList(firstItem, secondItem, nullItem);
  }
  protected ExactEstimate getTodaysStartValueWithScoping(
      IterationHistoryEntry yesterdayEntry, IterationHistoryEntry todayEntry) {

    long minorUnits = yesterdayEntry.getEffortLeftSum();
    minorUnits += todayEntry.getDeltaOriginalEstimate();

    return new ExactEstimate(minorUnits);
  }
 protected TimeSeriesDataItem getBurndownDataItemForDay(IterationHistoryEntry entry) {
   TimeSeriesDataItem item =
       new TimeSeriesDataItem(
           new Second(
               entry
                   .getTimestamp()
                   .toDateTimeAtCurrentTime()
                   .minusMinutes(timeDifferenceMinutes)
                   .toDateMidnight()
                   .plusDays(1)
                   .toDate()),
           ExactEstimateUtils.extractMajorUnits(new ExactEstimate(entry.getEffortLeftSum())));
   return item;
 }
 protected IterationHistoryEntry getHistoryEntryForDate(
     List<IterationHistoryEntry> entries, LocalDate date) {
   IterationHistoryEntry foundEntry = new IterationHistoryEntry();
   for (IterationHistoryEntry entry : entries) {
     if (entry.getTimestamp().equals(date)) {
       return entry;
     }
     if (entry.getTimestamp().compareTo(date) > 0) {
       break;
     }
     foundEntry = entry;
   }
   IterationHistoryEntry returnable = new IterationHistoryEntry();
   returnable.setTimestamp(date.toDateMidnight().toLocalDate());
   returnable.setEffortLeftSum(foundEntry.getEffortLeftSum());
   returnable.setOriginalEstimateSum(foundEntry.getOriginalEstimateSum());
   return returnable;
 }
  protected Pair<TimeSeriesDataItem, TimeSeriesDataItem> getBurndownScopedDataItemForDay(
      IterationHistoryEntry yesterdayEntry, IterationHistoryEntry todayEntry) {
    DateTime timestamp =
        todayEntry
            .getTimestamp()
            .toDateTimeAtCurrentTime()
            .minusMinutes(timeDifferenceMinutes)
            .toDateMidnight()
            .toDateTime()
            .plusSeconds(2);
    Second period = new Second(timestamp.toDate());

    long longValue = yesterdayEntry.getEffortLeftSum() + todayEntry.getDeltaOriginalEstimate();
    ExactEstimate scopedValue = new ExactEstimate(longValue);

    TimeSeriesDataItem nullItem =
        new TimeSeriesDataItem(new Second(timestamp.minusSeconds(1).toDate()), null);
    TimeSeriesDataItem scopedItem =
        new TimeSeriesDataItem(period, ExactEstimateUtils.extractMajorUnits(scopedValue));

    return Pair.create(nullItem, scopedItem);
  }
  /**
   * Get the <code>TimeSeries</code> for drawing the current day line.
   *
   * @param timeDifferenceHours
   */
  protected TimeSeries getCurrentDayTimeSeries(
      IterationHistoryEntry yesterdayEntry, IterationHistoryEntry todayEntry) {
    ExactEstimate startValue = this.getTodaysStartValueWithScoping(yesterdayEntry, todayEntry);

    ExactEstimate endValue = new ExactEstimate(todayEntry.getEffortLeftSum());

    return this.getSeriesByStartAndEndPoints(
        CURRENT_DAY_SERIES_NAME,
        todayEntry
            .getTimestamp()
            .toDateTimeAtCurrentTime()
            .minusMinutes(timeDifferenceMinutes)
            .toDateMidnight()
            .toDateTime(),
        startValue,
        todayEntry
            .getTimestamp()
            .toDateTimeAtCurrentTime()
            .minusMinutes(timeDifferenceMinutes)
            .toDateMidnight()
            .toDateTime()
            .plusDays(1),
        endValue);
  }