Skip to content

Commit

Permalink
Forward progression properties when relaying a progression
Browse files Browse the repository at this point in the history
When the progression condition that is to be relayed was created with
any arguments, they need to be relayed as well when creating a new
progression object in progress_aggregator().

Fixes #126.
  • Loading branch information
mlell committed Nov 12, 2021
1 parent da3dc98 commit 9289436
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion R/progress_aggregator.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ progress_aggregator <- function(progress) {
} else if (type == "reset") {
} else if (type == "shutdown") {
} else if (type == "update") {
progress(child = p)
call_progressor_with_progress(progress, p)
} else {
stop("Unknown 'progression' type: ", sQuote(type))
}
Expand All @@ -49,3 +49,18 @@ progress_aggregator <- function(progress) {

fcn
}

call_progressor_with_progress <- function(progr, prog_cond){
c <- setdiff(class(prog_cond), c("progression", "immediateCondition", "condition"))
arg_list <- unclass(prog_cond)
# Remove all arguments from the list that are not included by the progressor
# (the function generated by a call to the progressor() function) into the
# resulting condition object but are set by the progressor itself. See
# the function that is the return value of progressor() for those arguments.
arg_list$owner_session_uuid <- NULL
arg_list$progressor_uuid <- NULL
arg_list$progression_index <- NULL
arg_list$call <- NULL
arg_list$calls <- NULL
do.call(progr, arg_list)
}
3 changes: 3 additions & 0 deletions R/progressor.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ progressor <- local({
type = type,
message = message,
...,
# If adding values here that do not come from the parameters of this
# inner function, include them in call_progressor_with_progress() as
# well
progressor_uuid = progressor_uuid,
progression_index = progression_index,
owner_session_uuid = owner_session_uuid,
Expand Down

0 comments on commit 9289436

Please sign in to comment.