Skip to content

Commit d90d5e6

Browse files
committed
feat: check postprocessor for forecast_date in forecast.epi_workflow
1 parent 990269d commit d90d5e6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/epi_workflow.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,17 @@ forecast.epi_workflow <- function(object, ..., fill_locf = FALSE, n_recent = NUL
360360
))
361361
}
362362

363+
frosting_fd <- NULL
364+
if (has_postprocessor(object) && detect_layer(object, "layer_add_forecast_date")) {
365+
frosting_fd <- extract_argument(object, "layer_add_forecast_date", "forecast_date")
366+
}
367+
363368
test_data <- get_test_data(
364369
hardhat::extract_preprocessor(object),
365370
object$original_data,
366371
fill_locf = fill_locf,
367372
n_recent = n_recent %||% Inf,
368-
forecast_date = forecast_date %||% max(object$original_data$time_value)
373+
forecast_date = forecast_date %||% frosting_fd %||% max(object$original_data$time_value)
369374
)
370375

371376
predict(object, new_data = test_data)

0 commit comments

Comments
 (0)