R/nglbops_von_nach.R

Defines functions nglbops_von_nach

nglbops_von_nach <- function(x,type) {

require(purrr)
require(tidyverse)

y <- x$fields

if (as.POSIXct(gsub('T',' ',y$created)) > '2019-01-01') {

  von <- ifelse(is_empty(y$customfield_11500)==TRUE,NA,
         ifelse(y$customfield_11500$value == 'Other',y$customfield_11313,y$customfield_11500$value))
  nach <- ifelse(is_empty(y$customfield_11501)==TRUE,NA,
         ifelse(y$customfield_11501$value == 'Other',y$customfield_11314,y$customfield_11501$value))

} else {

  von <- ifelse(is_empty(y$customfield_11313)==TRUE,NA,y$customfield_11313)
  nach <- ifelse(is_empty(y$customfield_11314)==TRUE,NA,y$customfield_11314)

}

if (type == 'von') {

  return(von)

} else if (type == 'nach') {

  return(nach)

} else {

stop('The value for "type" needs to be either "von" or "nach"')

}

}
neugelb/njira documentation built on Sept. 2, 2020, 7:02 p.m.