Skip to content

Commit

Permalink
Merge pull request #309 from ffverse/dev
Browse files Browse the repository at this point in the history
v1.4.5 - fix cran donttest stuff
  • Loading branch information
tanho63 authored Jul 25, 2021
2 parents 6f61f4a + 7ecd540 commit 4eff00d
Show file tree
Hide file tree
Showing 99 changed files with 418 additions and 144 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: ffscrapr
Title: API Client for Fantasy Football League Platforms
Version: 1.4.4
Version: 1.4.5
Authors@R:
c(person(given = "Tan",
family = "Ho",
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# ffscrapr 1.4.5

The main goal of v1.4.5 is to comply with CRAN somehow testing our examples.

## Minor changes
- `ff_league()` for ESPN now works for non-ppr leagues.
- Include `try()` in all examples because apparently `\donttest` doesn't do anything anymore 😡 (fixes #308)

---

# ffscrapr 1.4.4

The main goal of v1.4.4 is to patch minor bugs and to add some minor extensions such as an HTML cleaning function. v1.4.4 is also served from a different github organization and website domain.
Expand Down
2 changes: 1 addition & 1 deletion R/0_generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#'
#' @examples
#' \donttest{
#' ff_connect(platform = "mfl", season = 2019, league_id = 54040, rate_limit = FALSE)
#' ff_connect(platform = "mfl", season = 2019, league_id = 54040, rate_limit = FALSE)
#' }
#' @export ff_connect
#' @return a connection object to be used with `ff_*` functions
Expand Down
9 changes: 7 additions & 2 deletions R/1_import_dp.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#'
#' @examples
#' \donttest{
#' dp_values()
#' try( # try only shown here because sometimes CRAN checks are weird
#' dp_values()
#' )
#' }
#'
#' @return a tibble of trade values from DynastyProcess
Expand Down Expand Up @@ -42,7 +44,9 @@ dp_values <- function(file = c("values.csv", "values-players.csv", "values-picks
#'
#' @examples
#' \donttest{
#' dp_playerids()
#' try( # try only shown here because sometimes CRAN checks are weird
#' dp_playerids()
#' )
#' }
#'
#' @seealso <https://github.com/DynastyProcess/data>
Expand Down Expand Up @@ -84,6 +88,7 @@ dp_playerids <- function() {
#'
#' @examples
#' \donttest{
#'
#' dp_cleannames(c("A.J. Green", "Odell Beckham Jr.", "Le'Veon Bell Sr."))
#'
#' dp_cleannames(c("Trubisky, Mitch", "Atwell, Chatarius", "Elliott, Zeke", "Elijah Moore"),
Expand Down
8 changes: 6 additions & 2 deletions R/1_import_nflfastr.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#'
#' @examples
#' \donttest{
#' nflfastr_weekly()
#' try( # try only shown here because sometimes CRAN checks are weird
#' nflfastr_weekly()
#' )
#' }
#'
#' @return Weekly stats for all passers, rushers and receivers in the nflfastR play-by-play data from the 1999 season to the most recent season
Expand Down Expand Up @@ -56,7 +58,9 @@ nflfastr_weekly <- function(type = c("offense", "defense", "all")) {
#'
#' @examples
#' \donttest{
#' nflfastr_rosters(seasons = 2019:2020)
#' try( # try only shown here because sometimes CRAN checks are weird
#' nflfastr_rosters(seasons = 2019:2020)
#' )
#' }
#'
#' @return Data frame where each individual row represents a player in the roster of the given team and season
Expand Down
6 changes: 6 additions & 0 deletions R/espn__helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,16 @@
"24" = "rushingYards",
"25" = "rushingTouchdowns",
"26" = "rushing2PtConversions",
"35" = "rushing40YardTD",
"37" = "rushing100YardGame",
"38" = "rushing200YardGame",
"42" = "receivingYards",
"43" = "receivingTouchdowns",
"44" = "receiving2PtConversions",
"45" = "receiving40YardTD",
"53" = "receivingReceptions",
"56" = "receiving100YardGame",
"57" = "receiving200YardGame",
"63" = "fumbleRecoveryTouchdown",
"72" = "lostFumbles",
"74" = "madeFieldGoalsFrom50Plus",
Expand Down
6 changes: 4 additions & 2 deletions R/espn_draft.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#'
#' @examples
#' \donttest{
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_draft(conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_draft(conn)
#' }) # end try
#' }
#'
#' @describeIn ff_draft ESPN: returns the current year's draft/auction, including details on keepers
Expand Down
2 changes: 2 additions & 0 deletions R/espn_draftpicks.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(
#' season = 2018,
#' league_id = 1178049,
Expand All @@ -17,6 +18,7 @@
#' )
#'
#' ff_draftpicks(conn)
#' }) # end try
#' }
#'
#' @export
Expand Down
8 changes: 6 additions & 2 deletions R/espn_franchises.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
#'
#' @examples
#' \donttest{
#' conn <- espn_connect(season = 2020, league_id = 1178049)
#' try({ # try only shown here because sometimes CRAN checks are weird
#'
#' ff_franchises(conn)
#' conn <- espn_connect(season = 2020, league_id = 1178049)
#'
#' ff_franchises(conn)
#'
#' }) # end try
#' }
#'
#' @describeIn ff_franchises ESPN: returns franchise and division information.
Expand Down
25 changes: 17 additions & 8 deletions R/espn_league.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
#'
#' @examples
#' \donttest{
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_league(conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#'
#' conn <- espn_connect(season = 2020, league_id = 899513)
#'
#' ff_league(conn)
#' }) # end try
#' }
#'
#' @describeIn ff_league ESPN: returns a summary of league features.
Expand Down Expand Up @@ -87,12 +91,17 @@ ff_league.espn_conn <- function(conn) {
#' @noRd
.espn_check_ppr <- function(league_endpoint) {
stat_map <- .espn_stat_map()
stat_ids <- league_endpoint$content$settings$scoringSettings$scoringItems %>% purrr::map_chr(~ .x$statId)
stat_ids_named <- stat_map[stat_ids] # %>% purrr::discard(~is.na(.x))
idx_rec <- which(stat_ids_named == "receivingReceptions")
seq_stat_ids <- seq_along(stat_ids)
ppr <- league_endpoint$content$settings$scoringSettings$scoringItems[idx_rec][[1]]$point
ifelse(ppr > 0, paste0(ppr, "_ppr"), "zero_ppr")
ppr <- league_endpoint %>%
purrr::pluck("content","settings","scoringSettings","scoringItems") %>%
purrr::map(`[`,c("statId","points")) %>%
dplyr::bind_rows() %>%
dplyr::mutate(
stat_name = .espn_stat_map()[as.character(.data$statId)]
) %>%
dplyr::filter(.data$stat_name == "receivingReceptions") %>%
dplyr::pull("points")

ifelse(length(ppr) > 0 && ppr!=0, paste0(ppr, "_ppr"), "zero_ppr")
}

#' @noRd
Expand Down
8 changes: 6 additions & 2 deletions R/espn_players.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
#'
#' @examples
#' \donttest{
#' conn <- espn_connect(season = 2020, league_id = 1178049)
#' try({ # try only shown here because sometimes CRAN checks are weird
#'
#' player_list <- espn_players(conn, season = 2020)
#' conn <- espn_connect(season = 2020, league_id = 1178049)
#'
#' espn_players(conn, season = 2020)
#'
#' }) # end try
#' }
#'
#' @return a dataframe containing all ~2000+ active players in the ESPN database
Expand Down
8 changes: 6 additions & 2 deletions R/espn_playerscores.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#'
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_playerscores(conn, limit = 5)
#' conn <- espn_connect(season = 2020, league_id = 899513)
#'
#' ff_playerscores(conn, limit = 5)
#'
#' }) # end try
#' }
#' @export
ff_playerscores.espn_conn <- function(conn, limit = 1000, ...) {
Expand Down
7 changes: 4 additions & 3 deletions R/espn_potentialpoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
#'
#' @examples
#' \donttest{
#'
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' espn_potentialpoints(conn, weeks = 1:3)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' espn_potentialpoints(conn, weeks = 1:3)
#' }) # end try
#' }
#' @export

Expand Down
6 changes: 4 additions & 2 deletions R/espn_rosters.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#'
#' @examples
#' \donttest{
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_league(conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_league(conn)
#' }) # end try
#' }
#' @describeIn ff_rosters ESPN: Returns all roster data.
#' @export
Expand Down
6 changes: 4 additions & 2 deletions R/espn_schedule.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#'
#' @examples
#' \donttest{
#' espn_conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_schedule(espn_conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' espn_conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_schedule(espn_conn)
#' }) # end try
#' }
#'
#' @describeIn ff_schedule ESPN: returns schedule data, one row for every franchise for every week. Completed games have result data.
Expand Down
6 changes: 4 additions & 2 deletions R/espn_scoring.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#'
#' @examples
#' \donttest{
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_scoring(conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_scoring(conn)
#' }) # end try
#' }
#'
#' @describeIn ff_scoring ESPN: returns scoring settings in a flat table, override positions have their own scoring.
Expand Down
6 changes: 4 additions & 2 deletions R/espn_scoringhistory.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#'
#' @examples
#' \donttest{
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_scoringhistory(conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_scoringhistory(conn, season = 2020)
#' }) # end try
#' }
#'
#' @describeIn ff_scoringhistory ESPN: returns scoring history in a flat table, one row per player per week.
Expand Down
6 changes: 4 additions & 2 deletions R/espn_standings.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#'
#' @examples
#' \donttest{
#' espn_conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_standings(espn_conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' espn_conn <- espn_connect(season = 2020, league_id = 899513)
#' ff_standings(espn_conn)
#' }) # end try
#' }
#'
#' @describeIn ff_standings ESPN: returns standings and points data.
Expand Down
2 changes: 2 additions & 0 deletions R/espn_starterpositions.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(season = 2020, league_id = 1178049)
#' ff_starter_positions(conn)
#' }) # end try
#' }
#'
#' @export
Expand Down
2 changes: 2 additions & 0 deletions R/espn_starters.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- espn_connect(season = 2020, league_id = 1178049)
#' ff_starters(conn, weeks = 1:3)
#' }) # end try
#' }
#'
#' @export
Expand Down
6 changes: 4 additions & 2 deletions R/flea_draft.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#'
#' @examples
#' \donttest{
#' conn <- fleaflicker_connect(season = 2020, league_id = 206154)
#' ff_draft(conn)
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- fleaflicker_connect(season = 2020, league_id = 206154)
#' ff_draft(conn)
#' }) # end try
#' }
#'
#' @describeIn ff_draft Fleaflicker: returns a table of drafts for the current year
Expand Down
2 changes: 2 additions & 0 deletions R/flea_draftpicks.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- fleaflicker_connect(2020, 206154)
#' ff_draftpicks(conn, franchise_id = 1373475)
#' }) # end try
#' }
#'
#' @export
Expand Down
2 changes: 2 additions & 0 deletions R/flea_franchises.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- fleaflicker_connect(season = 2020, league_id = 206154)
#' ff_franchises(conn)
#' }) # end try
#' }
#'
#' @describeIn ff_franchises Fleaflicker: returns franchise and division information.
Expand Down
2 changes: 2 additions & 0 deletions R/flea_league.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- fleaflicker_connect(2020, 206154)
#' ff_league(conn)
#' }) # end try
#' }
#'
#' @describeIn ff_league Flea: returns a summary of league features.
Expand Down
2 changes: 2 additions & 0 deletions R/flea_players.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#'
#' @examples
#' \donttest{
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- fleaflicker_connect(2020, 312861)
#' player_list <- fleaflicker_players(conn, page_limit = 2)
#' }) # end try
#' }
#'
#' @return a dataframe containing all ~7000+ players in the Fleaflicker database
Expand Down
7 changes: 4 additions & 3 deletions R/flea_playerscores.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
#'
#' @examples
#' \donttest{
#'
#' try({ # try only shown here because sometimes CRAN checks are weird
#' conn <- fleaflicker_connect(2020, 312861)
#' x <- ff_playerscores(conn, page_limit = 2)
#' x
#' ff_playerscores(conn, page_limit = 2)
#' }) # end try
#'
#' }
#' @export
ff_playerscores.flea_conn <- function(conn, page_limit = NULL, ...) {
Expand Down
Loading

0 comments on commit 4eff00d

Please sign in to comment.