Skip to content

Commit

Permalink
Condensed code
Browse files Browse the repository at this point in the history
Condensed line of code where vars are fetched when output variable is changed
  • Loading branch information
ciara-donegan committed Sep 12, 2024
1 parent 1f22881 commit f1103f3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions inst/shinyApp/components/modules/mod_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ run_server <- function(id, r6) {
r6$output <- bind_rows(runs)
print("Done")

# Save scenarios used in run
r6$ini_list <- unique(r6$output$Scenario)

output$graph <- renderPlotly({
Expand All @@ -153,16 +154,13 @@ run_server <- function(id, r6) {
observe({
r6$selected_var <- reactive({input$variable})
runs <- list()
#browser()

for(i in 1:length(r6$ini_list)) {
runs[[i]] <- fetchvars(r6$core[[i]], r6$time()[1]:r6$time()[2], vars = list(r6$selected_var())) %>%
mutate(Scenario = names(which(scenarios == scenarios[[r6$ini_list[i]]], arr.ind = FALSE)))
mutate(Scenario = r6$ini_list[i])
}
#browser()

r6$output <- bind_rows(runs)
#browser()

output$graph <- renderPlotly({
graph_plots(r6 = r6)
Expand Down

0 comments on commit f1103f3

Please sign in to comment.