Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1125 bug fix@main #1126

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 4 additions & 41 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,46 +104,6 @@ report_card_template <- function(title, label, description = NULL, with_filter,
card
}

#' Resolve `datanames` for the modules
#'
#' Modifies `module$datanames` to include names of the parent dataset (taken from `join_keys`).
#' When `datanames` is set to `"all"` it is replaced with all available datasets names.
#' @param modules (`teal_modules`) object
#' @param datanames (`character`) names of datasets available in the `data` object
#' @param join_keys (`join_keys`) object
#' @return `teal_modules` with resolved `datanames`.
#' @keywords internal
resolve_modules_datanames <- function(modules, datanames, join_keys) {
if (inherits(modules, "teal_modules")) {
modules$children <- sapply(
modules$children,
resolve_modules_datanames,
simplify = FALSE,
datanames = datanames,
join_keys = join_keys
)
modules
} else {
modules$datanames <- if (identical(modules$datanames, "all")) {
datanames
} else if (is.character(modules$datanames)) {
extra_datanames <- setdiff(modules$datanames, datanames)
if (length(extra_datanames)) {
stop(
sprintf(
"Module %s has datanames that are not available in a 'data':\n %s not in %s",
modules$label,
toString(extra_datanames),
toString(datanames)
)
)
}
datanames_adjusted <- intersect(modules$datanames, datanames)
include_parent_datanames(dataname = datanames_adjusted, join_keys = join_keys)
}
modules
}
}

#' Check `datanames` in modules
#'
Expand Down Expand Up @@ -256,7 +216,10 @@ modules_datasets <- function(data, modules, filters, filtered_data_singleton = t
teal.data::join_keys(data)
)
} else {
modules$datanames
include_parent_datanames(
modules$datanames,
teal.data::join_keys(data)
)
}
# 2. subset filters (global + dedicated)
slices <- shiny::isolate({
Expand Down
23 changes: 0 additions & 23 deletions man/resolve_modules_datanames.Rd

This file was deleted.

Loading