From 9289436cc7df6ad3bb70a678ecc949129d0961f1 Mon Sep 17 00:00:00 2001 From: Moritz Lell Date: Sat, 13 Nov 2021 00:59:05 +0100 Subject: [PATCH] Forward progression properties when relaying a progression 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. --- R/progress_aggregator.R | 17 ++++++++++++++++- R/progressor.R | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/R/progress_aggregator.R b/R/progress_aggregator.R index fa177bc..7b25f11 100644 --- a/R/progress_aggregator.R +++ b/R/progress_aggregator.R @@ -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)) } @@ -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) +} diff --git a/R/progressor.R b/R/progressor.R index 4b9afe0..40088ec 100644 --- a/R/progressor.R +++ b/R/progressor.R @@ -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,