Skip to content

Commit

Permalink
changes to append_evaluated_code
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Nov 8, 2024
1 parent 57454b8 commit e62cf57
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions R/module_filter_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 1 addition & 4 deletions R/teal_data_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit e62cf57

Please sign in to comment.