Skip to content

Commit

Permalink
Update mod_figures.R
Browse files Browse the repository at this point in the history
- create error message when user selects single site that does not have the first characteristic sampled. This removes the coding error in the shiny app, but likely is not the most clear design of this part of the app.
  • Loading branch information
elisehinman committed Sep 9, 2023
1 parent c9261ff commit 3ee1e0d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions R/mod_figures.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,16 @@ mod_figures_server <- function(id, tadat){
if(all(input$selsites1=="All sites")){
react$plotdata = subset(react$dat, react$dat$groupname%in%c(react$groups))
}else{
react$plotdata = react$dat %>% dplyr::filter(MonitoringLocationIdentifier%in%input$selsites1)
}
plotdata = react$dat %>% dplyr::filter(MonitoringLocationIdentifier%in%input$selsites1)
if(!react$groups[1]%in%plotdata$groupname){
shiny::showModal(shiny::modalDialog(
title = "Whoops!",
paste0("You selected a site/sites where ", react$groups[1], " was not sampled. Please use the legend in the map above to select site(s) where ", react$groups[1], "was sampled.")
))
}else{
react$plotdata = plotdata
}
}
})

# benchmark widgets
Expand Down

0 comments on commit 3ee1e0d

Please sign in to comment.