Skip to content

Commit 5299f77

Browse files
Optimize code
1 parent 7a2a3c0 commit 5299f77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/functions.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ get_weekly_cost <- function(simu,mcyears,expansion=F){
121121
} else {
122122
cost <- data.frame(tidyr::expand_grid(mcYear=mcyears,timeId=1:52))%>%
123123
dplyr::mutate(ov_cost=0,cost_xpansion=0)
124+
api_study = is_api_study(simu)
124125
for (week in 1:52){
125126
for (scenario in mcyears){
126-
if (is_api_study(simu)){
127+
if (api_study){
127128
file = antaresRead::api_get(opts=simu,endpoint=paste0(simu$study_id,
128129
"/raw?path=output%2F",simu$simOutputName,"%2Fcriterion-",scenario,"-",week,"--optim-nb-1"),
129130
parse_result = "text",encoding = "UTF-8")

0 commit comments

Comments
 (0)