Skip to content

Commit 140338f

Browse files
committed
better handles status checks
1 parent d380b05 commit 140338f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

R/mod_run_model_api_calls.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,19 @@ mod_run_model_check_container_status <- function(
112112

113113
state <- res$state %||% "unknown"
114114
if (state == "Terminated") {
115-
if (res$detail_status == "Completed") {
115+
if ((res$detail_status %||% "Completed") == "Completed") {
116116
cat("model run success: ", id, "\n", sep = "")
117117
status("Success")
118118
} else {
119119
cat("model run error: ", id, "\n", res$error, "\n", sep = "")
120120
status(glue::glue("Error running the model ({id}): {res$error}"))
121121
}
122122
return(NULL)
123-
} else if (state == "Creating" || state == "unknown") {
123+
} else if (state %in% c("Creating", "unknown")) {
124124
# no need to change status
125125
} else {
126-
progress <- res$complete
126+
progress <- res$complete %||%
127+
list(Inpatients = 0, Outpatients = 0, AaE = 0)
127128
model_runs <- res$model_runs
128129

129130
if (is.null(progress)) {

0 commit comments

Comments
 (0)