Skip to content

Commit 9aec646

Browse files
committed
fixes issue with using the config$param_items
reverted to what we had before, except without the handling of function calls
1 parent a2e14ef commit 9aec646

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

R/mod_mitigators_server.R

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,24 @@ mod_mitigators_server <- function(
9090
_[strategies] |>
9191
purrr::map("interval")
9292

93-
purrr::walk(strategies, \(i) {
94-
slider_values[[mitigators_type]][[i]] <- c(
95-
# add the additional param items if they exist.
96-
config$params_items,
97-
list(
98-
interval = loaded_values[[i]] %||% default_interval
93+
strategies |>
94+
purrr::walk(\(i) {
95+
slider_values[[mitigators_type]][[i]] <- c(
96+
# add the additional param items if they exist.
97+
98+
# if the additional item is a list, chose the value for the current strategy
99+
purrr::map_if(config$params_items, is.list, ~ .x[[i]]),
100+
list(
101+
interval = loaded_values[[i]] %||% default_interval
102+
)
99103
)
100-
)
101104

102-
params[[mitigators_type]][[activity_type]][[i]] <- if (
103-
!is.null(loaded_values[[i]])
104-
) {
105-
slider_values[[mitigators_type]][[i]]
106-
}
107-
})
105+
params[[mitigators_type]][[activity_type]][[i]] <- if (
106+
!is.null(loaded_values[[i]])
107+
) {
108+
slider_values[[mitigators_type]][[i]]
109+
}
110+
})
108111

109112
tpm <- params$time_profile_mappings[[mitigators_type]][[activity_type]]
110113
time_profile_mappings$mappings <- tpm

0 commit comments

Comments
 (0)