Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle NULL externalId #18

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hawkinR
Title: R package to work with data from the Hawkin Dynamics API
Version: 1.0.3.1
Version: 1.0.3.2
Authors@R:
person("Lauren", "Green", , "[email protected]", role = c("aut", "cre"))
Description: Provides simple functionality with Hawkin Dynamics API. These functions are for use with 'Hawkin Dynamics Beta API' version 1.8-beta. You must be an Hawkin Dynamics user with active integration account to utilize functions within the package. This API is designed to get data out of your Hawkin Dynamics database into your own database. It is not designed to be accessed from client applications directly. There is a limit on the amount of data that can be returned in a single request. As your database grows, it will be necessary to use the from and to parameters to limit the size of the responses. Responses that exceed the memory limit will fail.
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## hawkinR v1.0.3.2

# bug fixes to all `get_tests_...` functions to handle NULL externalIds

## hawkinR v1.0.3.1

# bug fixes to get_atheletes function to handle NULL externalIds
Expand Down
61 changes: 33 additions & 28 deletions R/get_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,38 +189,43 @@ get_tests <- function(from = NULL, to = NULL, sync = FALSE, active = TRUE) {
# Prepare externalId vector
external <- base::c()

# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
# Identify External Ids
if( base::ncol(extDF) > 0) {
# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
}
}

}

external <- base::c(external, extRow)
}

external <- base::c(external, extRow)
} else {
external <- base::rep('NA', nrow(x))
}

# Athlete df from original df
Expand Down
61 changes: 33 additions & 28 deletions R/get_tests_ath.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,38 +189,43 @@ get_tests_ath <- function(athleteId, from = NULL, to = NULL, sync = FALSE, activ
# Prepare externalId vector
external <- base::c()

# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
# Identify External Ids
if( base::ncol(extDF) > 0) {
# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
}
}

}

external <- base::c(external, extRow)
}

external <- base::c(external, extRow)
} else {
external <- base::rep('NA', nrow(x))
}

# Athlete df from original df
Expand Down
61 changes: 33 additions & 28 deletions R/get_tests_group.R
Original file line number Diff line number Diff line change
Expand Up @@ -218,38 +218,43 @@ get_tests_group <- function(groupId, from = NULL, to = NULL, sync = FALSE, activ
# Prepare externalId vector
external <- base::c()

# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
# Identify External Ids
if( base::ncol(extDF) > 0) {
# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
}
}

}

external <- base::c(external, extRow)
}

external <- base::c(external, extRow)
} else {
external <- base::rep('NA', nrow(x))
}

# Athlete df from original df
Expand Down
61 changes: 33 additions & 28 deletions R/get_tests_team.R
Original file line number Diff line number Diff line change
Expand Up @@ -218,38 +218,43 @@ get_tests_team <- function(teamId, from = NULL, to = NULL, sync = FALSE, active
# Prepare externalId vector
external <- base::c()

# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
# Identify External Ids
if( base::ncol(extDF) > 0) {
# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
}
}

}

external <- base::c(external, extRow)
}

external <- base::c(external, extRow)
} else {
external <- base::rep('NA', nrow(x))
}

# Athlete df from original df
Expand Down
61 changes: 33 additions & 28 deletions R/get_tests_type.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,38 +208,43 @@ get_tests_type <- function(typeId, from = NULL, to = NULL, sync = FALSE, active=
# Prepare externalId vector
external <- base::c()

# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
# Identify External Ids
if( base::ncol(extDF) > 0) {
# Loop externalId columns
for (i in 1:base::nrow(extDF)) {

extRow <- NA

for (n in 1:base::ncol(extDF)) {

# get externalId name
extN <- base::names(extDF)[n]

# get ext id
extId <- extDF[i,n]

# create new external id name:id string
newExt <- base::paste0(extN, ":", extId)

# add new externalId string to row list if needed
extRow <- if( base::is.na(extId) ) {
# if extId NA, no change
extRow
} else {
# Add new string to extId Row
extRow <- if( base::is.na(extRow) ) {
base::paste0(newExt)
} else{
base::paste0(extRow, ",", newExt)
}
}

}

external <- base::c(external, extRow)
}

external <- base::c(external, extRow)
} else {
external <- base::rep('NA', nrow(x))
}

# Athlete df from original df
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ knitr::opts_chunk$set(
[![R-CMD-check](https://github.com/HawkinDynamics/hawkinR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/HawkinDynamics/hawkinR/actions/workflows/R-CMD-check.yaml) [![Last-changedate](https://img.shields.io/badge/last%20change-`r gsub('-', '--', Sys.Date())`-yellowgreen.svg)](/commits/master) [![license](https://img.shields.io/badge/license-MIT%20+%20file%20LICENSE-lightgrey.svg)](https://choosealicense.com/)
[![minimal R version](https://img.shields.io/badge/R%3E%3D-`r "3.5.0"`-6666ff.svg)](https://cran.r-project.org/)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![packageversion](https://img.shields.io/badge/Package%20version-`r "1.0.3.1"`-orange.svg?style=flat-square)](commits/master)
[![packageversion](https://img.shields.io/badge/Package%20version-`r "1.0.3.2"`-orange.svg?style=flat-square)](commits/master)
[![thanks-md](https://img.shields.io/badge/THANKS-md-ff69b4.svg)](THANKS.md)

<!-- badges: end -->
Expand Down
Loading
Loading