USEPA / TADAShiny

TADAShiny is a DRAFT R Shiny application (link to web version below) built on top of the TADA R Package (https://github.com/USEPA/TADA). It provides a user friendly, web accessible interface.
https://rconnect-public.epa.gov/TADAShiny/
Creative Commons Zero v1.0 Universal
11 stars 4 forks source link

Censored Data tab bug #158

Open cristinamullin opened 5 months ago

cristinamullin commented 5 months ago

Describe the bug

If a user clicks "Apply Methods to Dataset" more than once... the method is applied over and over.

For example, Non-Detect Handling Method = Multiply detection limit by x Multiplier (x) = 0.5 Over-Detect Handling Method = No change then each time the sum reduction = ½ ½ ½.

Also, multiple different methods can be applied now which does not make sense. A user must only select one, and then undo the method if they want to select and apply a different one after reviewing the table.

To Reproduce

Use any dataset and go to the censored data tab, click the "Apply Methods to Dataset" button more than once and observe.

Expected behavior

The "Apply Methods to Dataset" button should only be able to be clicked once. After that, the button should disappear or maybe turn grey. If a user wants to undo the method they can click the "Undo Method Application" button. If they click that, they the "Apply Methods to Dataset" should be made available again.

Screenshots

image

Reminders for TADA contributors addressing this issue

New features should include all of the following work:

JamesBisese commented 1 week ago

For the first part, I need to disable the select button after it has been applied once. This is done locally.

    # Button to apply the simple methods to the nd and od results in the dataset.
    shiny::observeEvent(input$apply_methods, {
      shinybusy::show_modal_spinner(
        spin = "double-bounce",
        color = "#0071bc",
        text = "Applying selected methods...",
        session = shiny::getDefaultReactiveDomain()
      )
      # disable the button so the user can not redo the handling
      shinyjs::disable("apply_methods")

still to do is toggle it back on if 'undo_methods' is hit.

JamesBisese commented 1 week ago

I added an 'enable' line, but now see that once you run the apply_method the first time you also have to disable to multiplier field because if you change that and then 'undo' it uses the new value and you can't get back to where you started.

This is what I added to the shiny::observeEvent(input$undo_methods

      # (re)enable the button so the user can redo the handling
      shinyjs::enable("apply_methods")
      shinyjs::enable("nd_mult")