Skip to content

Commit

Permalink
rosters handles ngs failing
Browse files Browse the repository at this point in the history
  • Loading branch information
tanho63 committed Mar 27, 2024
1 parent beb75bf commit f8065cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: nflfastR.roster
Title: Populates Roster Data
Version: 0.0.1
Version: 0.0.2
Authors@R:
c(person(given = "Sebastian",
family = "Carl",
Expand Down
9 changes: 4 additions & 5 deletions src/update_roster.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ build_rosters <-

shield <- build_rosters_shieldapi(season) |> fill_ids()

if (season < 2002)
roster <- shield
if (season < 2002) roster <- shield

if (season >= 2002 && season < 2016) {
weekly_rosters <- build_rosters_weekly_dataexchange(season)
Expand Down Expand Up @@ -62,7 +61,8 @@ build_rosters <-
}

if (season >= 2016) {
weekly_rosters <- build_rosters_weekly_ngsapi(season)
weekly_rosters <- purrr::possibly(build_rosters_weekly_ngsapi,
data.frame())(season)
if (nrow(weekly_rosters) > 0) {
roster <- convert_weekly_to_season_rosters(weekly_rosters)
shield <- build_rosters_shieldapi(season)
Expand Down Expand Up @@ -94,8 +94,7 @@ build_rosters <-
roster <- shield
}

if ((season < 2002 &&
length(roster) == 0) |
if ((season < 2002 && length(roster) == 0) |
(season >= 2002 && length(weekly_rosters) == 0)) {
return(invisible(NULL))
}
Expand Down

0 comments on commit f8065cf

Please sign in to comment.