From 97968dfc7f6eb95f83e282b959fadd6c355684ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:34:41 +0200 Subject: [PATCH 1/4] fix: data reactivity in tm_missing_data --- NEWS.md | 5 ++++- R/tm_missing_data.R | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 28177aa9a..4d52780ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,10 +5,13 @@ ### Enhancements * Added `teal.logger` functionality for logging changes in shiny inputs in all modules. +### Bug fixes +* Fixed a bug in `tm_missing_data` in "Group by Subject" that was not using reactive data call. + # teal.modules.general 0.3.0 ### Enhancements -* Updated the package docs and vignettes with the new way of specifying data for `teal::init()`. The `data` argument will accept a `teal_data` object +* Updated the package docs and vignettes with the new way of specifying data for `teal::init()`. The `data` argument will accept a `teal_data` object. ### Bug fixes * Outlier labels no longer appear out of bounds in `tm_a_regression`. diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index de72ee834..54821efde 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -464,8 +464,8 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par data_parent_keys <- reactive({ - if (length(parent_dataname) > 0 && parent_dataname %in% names(data)) { - keys <- teal.data::join_keys(data)[[dataname]] + if (length(parent_dataname) > 0 && parent_dataname %in% datanames(data())) { + keys <- teal.data::join_keys(data())[[dataname]] if (parent_dataname %in% names(keys)) { keys[[parent_dataname]] } else { From ade921cb9bd608cb9192987ef9a84ce370d78ccb Mon Sep 17 00:00:00 2001 From: vedhav Date: Wed, 14 Aug 2024 17:30:23 +0530 Subject: [PATCH 2/4] chore: use the new namespace after the refactor --- DESCRIPTION | 2 +- tests/testthat/test-shinytest2-tm_a_regression.R | 4 ++-- tests/testthat/test-shinytest2-tm_data_table.R | 2 +- tests/testthat/test-shinytest2-tm_file_viewer.R | 2 +- tests/testthat/test-shinytest2-tm_front_page.R | 2 +- tests/testthat/test-shinytest2-tm_g_association.R | 4 ++-- tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R | 4 ++-- tests/testthat/test-shinytest2-tm_misssing_data.R | 2 +- tests/testthat/test-shinytest2-tm_outliers.R | 4 ++-- tests/testthat/test-shinytest2-tm_t_crosstable.R | 4 ++-- tests/testthat/test-shinytest2-tm_variable_browser.R | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d7aef173f..2b0ce79d8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,7 +27,7 @@ Depends: ggplot2 (>= 3.4.0), R (>= 3.6), shiny (>= 1.6.0), - teal (>= 0.15.1), + teal (>= 0.15.2.9052), teal.transform (>= 0.5.0) Imports: checkmate (>= 2.1.0), diff --git a/tests/testthat/test-shinytest2-tm_a_regression.R b/tests/testthat/test-shinytest2-tm_a_regression.R index a8e010b32..ee09a7656 100644 --- a/tests/testthat/test-shinytest2-tm_a_regression.R +++ b/tests/testthat/test-shinytest2-tm_a_regression.R @@ -53,11 +53,11 @@ testthat::test_that("e2e - tm_a_regression: Data parameter and module label is p app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Regression" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-regression .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-regression .help-block") testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_data_table.R b/tests/testthat/test-shinytest2-tm_data_table.R index 91a5b4cc2..c6330d43d 100644 --- a/tests/testthat/test-shinytest2-tm_data_table.R +++ b/tests/testthat/test-shinytest2-tm_data_table.R @@ -27,7 +27,7 @@ test_that("e2e - tm_data_table: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Data Table" ) diff --git a/tests/testthat/test-shinytest2-tm_file_viewer.R b/tests/testthat/test-shinytest2-tm_file_viewer.R index 1b47cbd00..7a6eb12c6 100644 --- a/tests/testthat/test-shinytest2-tm_file_viewer.R +++ b/tests/testthat/test-shinytest2-tm_file_viewer.R @@ -34,7 +34,7 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree ) testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "File Viewer Module" ) diff --git a/tests/testthat/test-shinytest2-tm_front_page.R b/tests/testthat/test-shinytest2-tm_front_page.R index 573de7288..c329db949 100644 --- a/tests/testthat/test-shinytest2-tm_front_page.R +++ b/tests/testthat/test-shinytest2-tm_front_page.R @@ -28,7 +28,7 @@ test_that("e2e - tm_front_page: Initializes without errors and check html elemen app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Front page" ) diff --git a/tests/testthat/test-shinytest2-tm_g_association.R b/tests/testthat/test-shinytest2-tm_g_association.R index ac3c73401..a5219639e 100644 --- a/tests/testthat/test-shinytest2-tm_g_association.R +++ b/tests/testthat/test-shinytest2-tm_g_association.R @@ -52,11 +52,11 @@ testthat::test_that("e2e - tm_g_association: Data parameter and module label is app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Association" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-association .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-association .help-block") testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R b/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R index 1f1b6e7e9..429e67b41 100644 --- a/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R +++ b/tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R @@ -51,11 +51,11 @@ test_that("e2e - tm_g_scatterplotmatrix: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Scatterplot matrix" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-scatterplot_matrix .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-scatterplot_matrix .help-block") testthat::expect_match(encoding_dataset, "Datasets.*ADSL.*ADRS", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_misssing_data.R b/tests/testthat/test-shinytest2-tm_misssing_data.R index b0ac9a212..af35629ab 100644 --- a/tests/testthat/test-shinytest2-tm_misssing_data.R +++ b/tests/testthat/test-shinytest2-tm_misssing_data.R @@ -42,7 +42,7 @@ test_that("e2e - tm_missing_data: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Missing data" ) diff --git a/tests/testthat/test-shinytest2-tm_outliers.R b/tests/testthat/test-shinytest2-tm_outliers.R index a846c2a8b..33141e7ad 100644 --- a/tests/testthat/test-shinytest2-tm_outliers.R +++ b/tests/testthat/test-shinytest2-tm_outliers.R @@ -56,11 +56,11 @@ testthat::test_that("e2e - tm_outliers: Data parameter and module label is passe app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Outliers Module" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-outliers_module .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-outliers_module .help-block") testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE) testthat::expect_match(encoding_dataset, "Outlier data points", all = FALSE) diff --git a/tests/testthat/test-shinytest2-tm_t_crosstable.R b/tests/testthat/test-shinytest2-tm_t_crosstable.R index ff47b2ed7..8c55b365d 100644 --- a/tests/testthat/test-shinytest2-tm_t_crosstable.R +++ b/tests/testthat/test-shinytest2-tm_t_crosstable.R @@ -50,11 +50,11 @@ test_that("e2e - tm_t_crosstable: Initializes without errors", { app_driver$expect_no_shiny_error() testthat::expect_equal( - app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"), + app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"), "Cross Table" ) - encoding_dataset <- app_driver$get_text("#teal-main_ui-root-cross_table .help-block") + encoding_dataset <- app_driver$get_text("#teal-teal_modules-cross_table .help-block") testthat::expect_match(encoding_dataset, "Dataset:\\n *ADSL\\n", all = FALSE) app_driver$stop() diff --git a/tests/testthat/test-shinytest2-tm_variable_browser.R b/tests/testthat/test-shinytest2-tm_variable_browser.R index a81aa2acb..854f1352d 100644 --- a/tests/testthat/test-shinytest2-tm_variable_browser.R +++ b/tests/testthat/test-shinytest2-tm_variable_browser.R @@ -35,7 +35,7 @@ testthat::test_that("e2e - tm_variable_browser: content is displayed correctly." # Test tab name testthat::expect_equal( - trimws(app_driver$get_text("#teal-main_ui-root-active_tab > li.active")), + trimws(app_driver$get_text("#teal-teal_modules-active_tab > li.active")), "Variable browser (e2e)" ) From cfe2e6b69ae6c4d8ab39b121794957e1a0183704 Mon Sep 17 00:00:00 2001 From: vedhav Date: Wed, 14 Aug 2024 18:22:25 +0530 Subject: [PATCH 3/4] trigger ci From 602ccb7abd0f1f7752fb7409bfc7076e88071057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:11:06 +0200 Subject: [PATCH 4/4] fix: missing double colon --- R/tm_missing_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 54821efde..7af029e74 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -464,7 +464,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par data_parent_keys <- reactive({ - if (length(parent_dataname) > 0 && parent_dataname %in% datanames(data())) { + if (length(parent_dataname) > 0 && parent_dataname %in% teal.data::datanames(data())) { keys <- teal.data::join_keys(data())[[dataname]] if (parent_dataname %in% names(keys)) { keys[[parent_dataname]]