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

changes for filter panel constuctor #670

Merged
merged 8 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Suggests:
scda.2021 (>= 0.1.3),
teal.widgets (>= 0.1.1),
testthat (>= 2.0),
withr
withr,
yaml
VignetteBuilder:
knitr
RdMacros:
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# teal 0.11.1.9001

* Updated internals of `module_teal` to reflect changes in `teal.slice` and `teal.data`.
nikolas-burkoff marked this conversation as resolved.
Show resolved Hide resolved

# teal 0.11.1

### Enhancements
Expand Down
6 changes: 1 addition & 5 deletions R/dummy_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ get_dummy_cdisc_data <- function() { # nolint
#' @keywords internal
get_dummy_datasets <- function() { # nolint
dummy_cdisc_data <- get_dummy_cdisc_data()
datasets <- teal.slice:::filtered_data_new(dummy_cdisc_data)
isolate({
teal.slice:::filtered_data_set(dummy_cdisc_data, datasets)
})
return(datasets)
return(teal.slice::init_filtered_data(dummy_cdisc_data))
}

#' Get dummy modules
Expand Down
5 changes: 2 additions & 3 deletions R/module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ srv_teal <- function(id, modules, raw_data, filter = list()) {
env$progress$set(0.25, message = "Setting data")
# create the FilteredData object (here called 'datasets') whose class depends on the class of raw_data()
# this is placed in the module scope so that bookmarking can be used with FilteredData object
datasets <- teal.slice:::filtered_data_new(raw_data())
# transfer the datasets from raw_data() into the FilteredData object
teal.slice:::filtered_data_set(raw_data(), datasets)
datasets <- teal.slice::init_filtered_data(raw_data())

logger::log_trace("srv_teal@4 Raw Data transferred to FilteredData.")
datasets
})
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-module_nested_tabs.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
filtered_data <- teal.slice:::FilteredData$new()
filtered_data$set_dataset(teal.data::dataset(dataname = "iris", x = head(iris)))
filtered_data <- teal.slice::init_filtered_data(
list(iris = list(dataset = head(iris)))
)

test_module1 <- module(
label = "test1",
ui = function(id, ...) NULL,
Expand Down
9 changes: 6 additions & 3 deletions tests/testthat/test-module_tabs_with_filters.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
filtered_data <- teal.slice:::FilteredData$new()
filtered_data$set_dataset(teal.data::dataset(dataname = "iris", x = head(iris)))
filtered_data$set_dataset(teal.data::dataset(dataname = "mtcars", x = head(mtcars)))
filtered_data <- teal.slice::init_filtered_data(
list(
iris = list(dataset = head(iris)),
mtcars = list(dataset = head(mtcars))
)
)

test_module1 <- module(
label = "iris tab",
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ testthat::test_that("srv_teal initializes the data when raw_data changes", {
})

testthat::test_that("srv_teal initialized FilteredData based on the raw_data input", {
filtered_data <- teal.slice:::filtered_data_new(data)
teal.slice:::filtered_data_set(data, filtered_data)
filtered_data <- teal.slice::init_filtered_data(data)

shiny::testServer(
app = srv_teal,
Expand Down