Skip to content

Commit 9cc5502

Browse files
authored
Merge pull request #663 from The-Strategy-Unit/fix_results_url
fixes results url
2 parents 7bd9885 + 989796d commit 9cc5502

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

R/mod_run_model_api_calls.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ mod_run_model_submit <- function(
5454
}
5555

5656
url <- glue::glue(
57-
"{Sys.getenv('NHP_OUTPUTS_URI')}?{results$dataset}/{results$model_run_id}"
57+
Sys.getenv("NHP_OUTPUTS_URI"),
58+
"?{results$dataset}/{results$model_run_id}"
5859
)
5960
cat("results url: ", url, "\n", sep = "")
6061
results_url(url)
@@ -109,19 +110,21 @@ mod_run_model_check_container_status <- function(
109110
\(response) {
110111
res <- httr2::resp_body_json(response)
111112

112-
if (res$state == "Terminated") {
113-
if (res$detail_status == "Completed") {
113+
state <- res$state %||% "unknown"
114+
if (state == "Terminated") {
115+
if ((res$detail_status %||% "Completed") == "Completed") {
114116
cat("model run success: ", id, "\n", sep = "")
115117
status("Success")
116118
} else {
117119
cat("model run error: ", id, "\n", res$error, "\n", sep = "")
118120
status(glue::glue("Error running the model ({id}): {res$error}"))
119121
}
120122
return(NULL)
121-
} else if (res$state == "Creating") {
123+
} else if (state %in% c("Creating", "unknown")) {
122124
# no need to change status
123125
} else {
124-
progress <- res$complete
126+
progress <- res$complete %||%
127+
list(Inpatients = 0, Outpatients = 0, AaE = 0)
125128
model_runs <- res$model_runs
126129

127130
if (is.null(progress)) {

0 commit comments

Comments
 (0)