Skip to content

Commit

Permalink
toggle Apply Methods to Dataset button
Browse files Browse the repository at this point in the history
Disable "Apply Methods to Dataset" button on Censored Data tab if no Multiplier (x) is provided
  • Loading branch information
JamesBisese committed Dec 5, 2024
1 parent 4cd24e4 commit 66aafc5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/mod_TADA_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ mod_TADA_summary_server <- function(id, tadat) {
shiny::req(tadat$raw)
shiny::downloadButton(ns("download_working"),
"Download Working Dataset (.zip)",
style = "color: #fff; background-color: #337ab7; border-color: #2e6da4",
style = "color: #fff; background-color: #337ab7; border-color: #2e6da4; margin-bottom: 10px;",
contentType = "application/zip"
)
})
Expand Down
14 changes: 14 additions & 0 deletions R/mod_censored_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ mod_censored_data_server <- function(id, tadat) {
dat[1:10, ] # just show the first 10 records so user can see what happened to data
shinybusy::remove_modal_spinner(session = shiny::getDefaultReactiveDomain())
tadat$censor_applied <- TRUE

# disable the button so the user can not redo the handling
shinyjs::disable("apply_methods")
shinyjs::disable("nd_mult")
shinyjs::disable("nd_method")
shinyjs::disable("od_mult")
shinyjs::disable("od_method")
})

# this button appears after someone has applied the OD/ND methods, in case they want to undo and try another method instead
Expand All @@ -343,6 +350,13 @@ mod_censored_data_server <- function(id, tadat) {
"Result Value/Unit Copied from Detection Limit" # reset data types flag to what it was before simpleCensoredMethods function run
tadat$raw <- tadat$raw %>% dplyr::select(-TADA.CensoredMethod)
tadat$censor_applied <- FALSE

# enable the button so the user can re-apply the handling
shinyjs::enable("apply_methods")
shinyjs::enable("nd_mult")
shinyjs::enable("nd_method")
shinyjs::enable("od_mult")
shinyjs::enable("od_method")
})

# creates a nice table showing an example of how censored data were changed.
Expand Down

0 comments on commit 66aafc5

Please sign in to comment.