Skip to content

Commit

Permalink
Ensure state json is parsed so we can pull relevent parts from it
Browse files Browse the repository at this point in the history
  • Loading branch information
r-ash committed Dec 10, 2024
1 parent e36243f commit 287deeb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions R/downloads.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ download <- function(model_output, type, path_results, input, language = NULL) {
out <- naomi::hintr_prepare_agyw_download(model_output, input$pjnz,
download_path)
} else if (type == "datapack") {
model_fit_id <- input$state$model_fit$id
calibrate_id <- input$state$calibrate$id
state_json <- jsonlite::fromJSON(input$state, simplifyVector = FALSE)
model_fit_id <- state_json$model_fit$id
calibrate_id <- state_json$calibrate$id
ids <- data.frame(c("model_fit", "calibrate"),
c(model_fit_id, calibrate_id))
out <- naomi::hintr_prepare_datapack_download(model_output,
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-01-endpoints-download.R
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,9 @@ test_that("datapack download returns bytes", {

## Submit download request
submit <- endpoint_download_submit(q$queue)
submit_response <- submit$run(q$calibrate_id, "datapack")
payload <- setup_payload_download_request(include_vmmc = TRUE,
include_notes = FALSE)
submit_response <- submit$run(q$calibrate_id, "datapack", payload)

expect_equal(submit_response$status_code, 200)
expect_true(!is.null(submit_response$data$id))
Expand Down

0 comments on commit 287deeb

Please sign in to comment.