R/util_queue_summary.R

Defines functions util_queue_summary

#' Generate a summary tibble from a queue table
#'
#' This function takes a queue table as input and generates a summary tibble
#' with columns for Directory, Filename, Status, Hyperlink, and Information.
#'
#' @param queue_table The queue table containing the result data
#' @return A tibble summarizing the queue table data
#' @noRd
util_queue_summary <- function(queue_table) {
  queue_table |>
    dplyr::mutate(
      Tag = .data$tag,
      Directory = normalizePath(dirname(.data$script), winslash = "/"),
      Filename = basename(.data$script),
      Status = .data$status,
      Hyperlink = vapply(
        X = .data$result,
        FUN = function(x) {
          if (is.null(x)) {
            return("")
          }
          utils::head(x[["logs"]], 1)
        },
        FUN.VALUE = character(1)
      ),
      Information = vapply(
        X = .data$result,
        FUN = function(x) {
          if (is.null(x)) {
            return("")
          }
          x[["status"]][c("errors", "warnings")] |>
            unlist() |>
            paste0(collapse = "<br>")
        },
        FUN.VALUE = character(1)
      )
    ) |>
    dplyr::select(
      "Tag",
      "Directory",
      "Filename",
      "Status",
      "Hyperlink",
      "Information"
    )
}

Try the whirl package in your browser

Any scripts or data that you put into this service are public.

whirl documentation built on Oct. 25, 2026, 9:06 a.m.