From 8360970800586377821d9931bbfffc9738a5c436 Mon Sep 17 00:00:00 2001 From: Kartikeya Kirar Date: Mon, 24 Jun 2024 10:42:01 +0530 Subject: [PATCH 1/3] updating get_choices function. --- R/utils.R | 17 +++++++++++++++-- man/get_choices.Rd | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index a8fec2b8..67103501 100644 --- a/R/utils.R +++ b/R/utils.R @@ -87,6 +87,8 @@ report_card_template_goshawk <- function(title, #' #' This function returns choices based on the class of the input. #' If the input is of class `delayed_data`, it returns the `subset` of the input. +#' If `subset` is NULL and the input contains `var_label` and `var_choices`, +#' it throws an error prompting to resolve delayed inputs. #' Otherwise, it returns the input as is. #' #' @param choices An object that contains choices. @@ -94,8 +96,19 @@ report_card_template_goshawk <- function(title, #' @keywords internal get_choices <- function(choices) { if (inherits(choices, "delayed_data")) { - choices$subset + if (is.null(choices$subset)) { + if (!is.null(choices$var_label) && !is.null(choices$var_choices)) { + stop( + "Resolve delayed inputs by evaluating the code within the provided datasets. + Check ?teal.transform::resolve_delayed for more information." + ) + } else { + stop("Subset is NULL and necessary fields are missing.") + } + } else { + choices$subset + } } else { choices } -} +} \ No newline at end of file diff --git a/man/get_choices.Rd b/man/get_choices.Rd index 56cd5af1..a4e7229e 100644 --- a/man/get_choices.Rd +++ b/man/get_choices.Rd @@ -15,6 +15,8 @@ A vector of choices. \description{ This function returns choices based on the class of the input. If the input is of class \code{delayed_data}, it returns the \code{subset} of the input. +If \code{subset} is NULL and the input contains \code{var_label} and \code{var_choices}, +it throws an error prompting to resolve delayed inputs. Otherwise, it returns the input as is. } \keyword{internal} From db22a4817eb6e5f88c809b79e62de98a4a83ce4c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 05:15:02 +0000 Subject: [PATCH 2/3] [skip style] [skip vbump] Restyle files --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 67103501..215cc104 100644 --- a/R/utils.R +++ b/R/utils.R @@ -111,4 +111,4 @@ get_choices <- function(choices) { } else { choices } -} \ No newline at end of file +} From 531cdd414bd7b182174e654ebdc44d9a9e72de5e Mon Sep 17 00:00:00 2001 From: "27856297+dependabot-preview[bot]@users.noreply.github.com" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:12:52 +0000 Subject: [PATCH 3/3] [skip roxygen] [skip vbump] Roxygen Man Pages Auto Update --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 321b6837..a0ac332b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -77,4 +77,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2