Skip to content

Commit 5915aa9

Browse files
fix: refresh window end issue #1270 (#1284)
1 parent 33baf19 commit 5915aa9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/R/refresh.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ robyn_refresh <- function(json_file = NULL,
230230
totalDates <- as.Date(dt_input[, InputCollectRF$date_var][[1]])
231231
refreshStart <- InputCollectRF$window_start <- as.Date(InputCollectRF$window_start) + InputCollectRF$dayInterval * refresh_steps
232232
refreshStartWhich <- InputCollectRF$rollingWindowStartWhich <- which.min(abs(difftime(totalDates, refreshStart, units = "days")))
233-
refreshEnd <- InputCollectRF$window_end <- as.Date(InputCollectRF$window_end) + InputCollectRF$dayInterval * refresh_steps
233+
if (InputCollectRF$window_end %in% totalDates) {
234+
refreshEnd <- InputCollectRF$window_end <- as.Date(InputCollectRF$window_end) + InputCollectRF$dayInterval * refresh_steps
235+
} else {
236+
refreshEnd <- InputCollectRF$window_end <- as.Date(InputCollectRF$window_end) + 1
237+
}
234238
refreshEndWhich <- InputCollectRF$rollingWindowEndWhich <- which.min(abs(difftime(totalDates, refreshEnd, units = "days")))
235239
InputCollectRF$rollingWindowLength <- refreshEndWhich - refreshStartWhich + 1
236240
}

0 commit comments

Comments
 (0)