- {
- last_serie_end = tail( data$getSerie(index), 1)
- last_tomorrow_begin = head( data$getSerie(index+1), 1)
- index = index - ifelse(same_day,7,1)
- };
- if (!is.na(last_serie_end) && !is.na(last_tomorrow_begin))
- return (last_tomorrow_begin - last_serie_end);
+ # If 'same_day', get the last known future of similar day
+ index = index - ifelse(same_day,7,1)