ARawles / BMRSr

@@ -132,33 +132,3 @@
Loading
132 132
  return(x)
133 133
}
134 134
135 -
#' Fixes parameters provided in the `build_x_call()` functions
136 -
#'
137 -
#' @param param object; parameter to fix
138 -
#' @param before function; function to fix the parameter. `param` will be passed as the first argument to this function.
139 -
#' Default NULL does nothing
140 -
#' @param ... additional arguments passed to the `before` function
141 -
#' @export
142 -
#' @return modified `param` object (if `before` isn't NULL)
143 -
fix_parameter <- function(param, before = NULL, ...) {
144 -
  # If it's null, just return it because we're assigning this to a list, it won't be added anyway
145 -
  if (is.null(param)) {
146 -
    return(param)
147 -
  }
148 -
149 -
  if (!is.null(before)) {
150 -
    param <- do.call(before, args = list(param, ...))
151 -
  }
152 -
  param
153 -
}
154 -
155 -
check_period <- function(period) {
156 -
  if (!is.null(period)) {
157 -
    if (period <= 0 | period > 50){
158 -
      if (period != "*"){
159 -
        stop("invalid period value")
160 -
      }
161 -
    }
162 -
  }
163 -
  period
164 -
}

@@ -69,3 +69,39 @@
Loading
69 69
  }
70 70
  return(ret)
71 71
}
72 +
73 +
#' Fixes parameters provided in the `build_x_call()` functions
74 +
#'
75 +
#' @param param object; parameter to fix
76 +
#' @param before function; function to fix the parameter. `param` will be passed as the first argument to this function.
77 +
#' Default NULL does nothing
78 +
#' @param ... additional arguments passed to the `before` function
79 +
#' @return modified `param` object (if `before` isn't NULL)
80 +
fix_parameter <- function(param, before = NULL, ...) {
81 +
  # If it's null, just return it because we're assigning this to a list, it won't be added anyway
82 +
  if (is.null(param)) {
83 +
    return(param)
84 +
  }
85 +
86 +
  if (!is.null(before)) {
87 +
    param <- do.call(before, args = list(param, ...))
88 +
  }
89 +
  param
90 +
}
91 +
92 +
93 +
#' Check the the provided Settlement Period value is valid
94 +
#'
95 +
#' Currently accepted values for Settlement Period is 1-50 and *
96 +
#' @param period numeric/character; value to check. Must be numeric and between 1 and 50 or a character that's "*"
97 +
#' @return character; period as character
98 +
check_period <- function(period) {
99 +
  if (!is.null(period)) {
100 +
    if (period <= 0 | period > 50){
101 +
      if (period != "*"){
102 +
        stop("invalid period value")
103 +
      }
104 +
    }
105 +
  }
106 +
  as.character(period)
107 +
}

@@ -60,9 +60,9 @@
Loading
60 60
61 61
  input_params$SettlementDate  <- fix_parameter(settlement_date, format_date)
62 62
63 -
  check_period(period)
63 +
  period <- check_period(period)
64 64
65 -
  input_params$Period  <- fix_parameter(period, as.character)
65 +
  input_params$Period  <- fix_parameter(period)
66 66
  input_params$ProcessType  <- fix_parameter(process_type)
67 67
  input_params$Year  <- fix_parameter(year)
68 68
  input_params$Month  <- fix_parameter(month, format_month)
Files Coverage
R 73.93%
Project Totals (6 files) 73.93%
1
comment: false
2

3

4
coverage:
5
  status:
6
    project:
7
      default:
8
        target: auto
9
        threshold: 1%
10
    patch:
11
      default:
12
        target: auto
13
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading