From 66f917fffea6e6f47dfcc4432c3d4c9ccdb5a217 Mon Sep 17 00:00:00 2001 From: Chris Beeley Date: Fri, 10 Dec 2021 12:29:38 +0000 Subject: [PATCH] Check that data exists in filtering functions --- R/app_server.R | 3 +++ R/tidy_data.R | 2 ++ 2 files changed, 5 insertions(+) diff --git a/R/app_server.R b/R/app_server.R index cf80d1c..0100fcd 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -54,6 +54,7 @@ app_server <- function( input, output, session ) { output$filter_location_1 <- renderUI({ req(get_golem_config("location_1")) + req(data_exists) location_1_choices <- date_filter() %>% dplyr::distinct(location_1) %>% @@ -73,6 +74,7 @@ app_server <- function( input, output, session ) { output$filter_location_2 <- renderUI({ req(get_golem_config("location_2")) + req(data_exists) location_2_choices <- date_filter() @@ -99,6 +101,7 @@ app_server <- function( input, output, session ) { output$filter_location_3 <- renderUI({ req(get_golem_config("location_3")) + req(data_exists) location_3_choices <- date_filter() diff --git a/R/tidy_data.R b/R/tidy_data.R index dc248cc..4248569 100644 --- a/R/tidy_data.R +++ b/R/tidy_data.R @@ -27,6 +27,8 @@ tidy_all_trusts <- function(data, conn) { comment_txt %in% c("NULL", "NA", "N/A") ~ NA_character_, TRUE ~ category )) + } else { + data } }