diff --git a/R/epi_workflow.R b/R/epi_workflow.R index 72fe2b1f3..4be82dcc6 100644 --- a/R/epi_workflow.R +++ b/R/epi_workflow.R @@ -42,7 +42,7 @@ epi_workflow <- function(preprocessor = NULL, spec = NULL, postprocessor = NULL) if (is_epi_recipe(preprocessor)) { out <- add_epi_recipe(out, preprocessor) - }else if (!is_null(preprocessor)) { + } else if (!is_null(preprocessor)) { out <- workflows:::add_preprocessor(out, preprocessor) } if (!is_null(postprocessor)) { diff --git a/R/frosting.R b/R/frosting.R index b8bb75e8a..436ea2319 100644 --- a/R/frosting.R +++ b/R/frosting.R @@ -35,10 +35,23 @@ add_frosting <- function(x, frosting, ...) { rlang::check_dots_empty() action <- workflows:::new_action_post(frosting = frosting) - workflows:::add_action(x, action, "frosting") + epi_add_action(x, action, "frosting") } -order_stage_post <- function() "frosting" + +# Hacks around workflows `order_stage_post <- charcter(0)` ---------------- +epi_add_action <- function(x, action, name, ..., call = caller_env()) { + workflows:::validate_is_workflow(x, call = call) + add_action_frosting(x, action, name, ..., call = call) +} +add_action_frosting <- function(x, action, name, ..., call = caller_env()) { + workflows:::check_singleton(x$post$actions, name, call = call) + x$post <- workflows:::add_action_to_stage(x$post, action, name, order_stage_frosting()) + x +} +order_stage_frosting <- function() "frosting" +# End hacks. See cmu-delphi/epipredict#75 + #' @rdname add_frosting #' @export