Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Liming authored and clarkliming committed Nov 9, 2022
1 parent d3bc47e commit 92fb3a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 303 deletions.
11 changes: 9 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ set_decoration <- function(x, deco) {
}

#' Create a Null Report
#'
#' @rdname report_null
#' @aliases null_report
#' @param tlg (`TableTree`) object.
#' @param ... not used.
#'
Expand All @@ -218,13 +219,19 @@ set_decoration <- function(x, deco) {
#'
report_null <- function(tlg, ...) {
if (nrow(tlg) == 0L) {
rtables::rtable(header = "Null Report: No observations met the reporting criteria for inclusion in this output.")
null_report
} else {
checkmate::assert_multi_class(tlg, c("TableTree"))
tlg
}
}

#' @export
#' @rdname report_null
null_report <- rtables::rtable(
header = "",
rrow("Null Report: No observations met the reporting criteria for inclusion in this output.")
)

#' Prune Table up to an `ElementaryTable`
#'
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-empty_report.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ test_that("tlg functions return null reports when domain table is empty", {
dm_update_zoomed()

empty_report <- rtables::rtable(
header = "Null Report: No observations met the reporting criteria for inclusion in this output."
header = "",
rrow("Null Report: No observations met the reporting criteria for inclusion in this output.")
)
res <- run(aet01_1, dat_empty, prune_0 = TRUE)
expect_identical(res, empty_report)
Expand Down
300 changes: 0 additions & 300 deletions utils.R

This file was deleted.

0 comments on commit 92fb3a3

Please sign in to comment.