diff --git a/R/thematic_trimming.R b/R/thematic_trimming.R index b3bdb740..6df55953 100644 --- a/R/thematic_trimming.R +++ b/R/thematic_trimming.R @@ -24,13 +24,35 @@ #' } getThematicTrimming <- function(opts = simOptions()){ stopifnot(inherits(opts, "simOptions")) + stopifnot(opts$antaresVersion>=800) + + ## + # API bloc + ## + if(antaresRead:::is_api_study(opts = opts)){ + # use endpoint from API "Get thematic trimming config" + endpoint_to_use <- "config/thematictrimming/form" + endpoint_to_use <- file.path(opts$study_id, + endpoint_to_use) + + thematic_vars <- api_get(opts = opts, + endpoint = endpoint_to_use) + + return(thematic_vars) + } + + ## + # Desktop + ## # read study to update opts meta data - opts_study <- setSimulationPath(opts$studyPath, - simulation = "input") + suppressWarnings( + opts_study <- setSimulationPath(opts$studyPath, + simulation = "input") + ) - # use global referentiel - ref_list_vars_thematic <- antaresRead:::pkgEnv$thematic + # use private referentiel + ref_list_vars_thematic <- pkgEnv$thematic # filter vars with version ref_list_vars_thematic <- ref_list_vars_thematic[version<=opts_study$antaresVersion,] diff --git a/tests/testthat/test-thematic_timming.R b/tests/testthat/test-thematic_timming.R index ad469051..0419e7da 100644 --- a/tests/testthat/test-thematic_timming.R +++ b/tests/testthat/test-thematic_timming.R @@ -2,6 +2,8 @@ path_study_test <- grep(pattern = "86", x = studyPathSV8, value = TRUE) opts_study_test <- setSimulationPath(path_study_test, simulation = "input") +# NOTES : + # In this study test there is no section [selection variables] # test_that("Empty selection variables", { # # template study 860 as no section