From 9fe4999dd7eadbc702512f96471915d1d3c89059 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski <114988527+chlebowa@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:03:13 +0100 Subject: [PATCH] 1305 allow delayed data to pass in `cs_to_des_select` (#1306) FIxes #1305 Tested under current CRAN release and development versions: ``` > packageVersion("teal.transform") [1] '0.5.0.9018' > packageVersion("teal.modules.clinical") [1] '0.9.1.9042' ``` --------- Signed-off-by: Joe Zhu Co-authored-by: Joe Zhu --- NEWS.md | 3 +++ R/utils.R | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 6ab82c1a4..4178e698f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,9 @@ * Began deprecation cycle for the `show_labels` argument of `template_summary` which has no effect on the `tm_t_summary` module. * Replaced instances of deprecated `strata` argument to `tern::control_lineplot_vars()` with `group_var`. +### Bug fixes +* Fixed bug in creating modules with `delayed_data` and `teal.transform::all_choices`. + # teal.modules.clinical 0.9.1 ### Enhancements diff --git a/R/utils.R b/R/utils.R index f3a4e916f..2661cc194 100644 --- a/R/utils.R +++ b/R/utils.R @@ -300,8 +300,8 @@ cs_to_des_select <- function(cs, dataname, multiple = FALSE, ordered = FALSE, la checkmate::check_class(cs, classes = "choices_selected"), .var.name = cs_name ) - if (!multiple && length(cs$selected) != 1 && !is.null(cs$selected)) { - stop(cs_name, "must only have 1 selected value") + if (!inherits(cs$selected, "delayed_data") && !multiple && length(cs$selected) != 1 && !is.null(cs$selected)) { + stop(cs_name, " must only have 1 selected value") } if (inherits(cs, "choices_selected")) {