diff --git a/R/module_filter_data.R b/R/module_filter_data.R index 14dc7b4ecf..ff0ad6f68b 100644 --- a/R/module_filter_data.R +++ b/R/module_filter_data.R @@ -62,9 +62,12 @@ srv_filter_data <- function(id, datasets, active_datanames, data_rv, is_active) ) ) filtered_code <- .get_filter_expr(datasets = datasets, datanames = datanames) + # Can below 3 lines be substituted with filtered_teal_data <- .append_evaluated_code(data, filtered_code) filtered_datasets <- sapply(datanames, function(x) datasets$get_data(x, filtered = TRUE), simplify = FALSE) filtered_teal_data <- .append_modified_data(filtered_teal_data, filtered_datasets) + # this line + # filtered_teal_data <- eval_code(data, filtered_code) filtered_teal_data } diff --git a/R/teal_data_utils.R b/R/teal_data_utils.R index d1078d77cb..89b8757041 100644 --- a/R/teal_data_utils.R +++ b/R/teal_data_utils.R @@ -20,10 +20,7 @@ NULL #' @rdname teal_data_utilities .append_evaluated_code <- function(data, code) { checkmate::assert_class(data, "teal_data") - data@code <- c(data@code, code) - data@id <- c(data@id, max(data@id) + 1L + seq_along(code)) - data@messages <- c(data@messages, rep("", length(code))) - data@warnings <- c(data@warnings, rep("", length(code))) + data@code <- c(data@code, code2list(code)) methods::validObject(data) data } diff --git a/R/zzz.R b/R/zzz.R index a991d041f2..62c8029561 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -37,3 +37,4 @@ RcodeBlock <- getFromNamespace("RcodeBlock", "teal.reporter") # nolint: object_n # Use non-exported function(s) from teal.code # This one is here because lang2calls should not be exported from teal.code lang2calls <- getFromNamespace("lang2calls", "teal.code") +code2list <- getFromNamespace("code2list", "teal.data")