From a59e2944b80d130beffa6630881f01cc48bed08d Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Fri, 12 Feb 2021 21:50:56 -0500 Subject: [PATCH] fix mfl starters bugs --- DESCRIPTION | 2 +- NEWS.md | 1 + R/espn_league.R | 5 +---- R/mfl_starters.R | 8 ++++---- man/ff_league.Rd | 5 +---- man/ff_starters.Rd | 4 ++-- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b7e6e46a..abb06325 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.2.2.12 +Version: 1.2.2.13 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index 3d94a090..a42dd6af 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,6 +21,7 @@ - Fixed bug in MFL's `ff_playerscores()` function so that it correctly pulls older names. (#196, thanks for reporting Mike!) (v1.2.2.11) - Actually export `dp_cleannames()` and add it to the NAMESPACE so it's accessible to the end user, whoops. - Refactored all tests to move test cache files to a separate/non-package location (https://github.com/dynastyprocess/ffscrapr-tests) - so that it is not included in CRAN's package sizing (v1.2.2.12) +- Fixed bugs in MFL's `ff_starters()` function - bad default arg # ffscrapr 1.2.2 diff --git a/R/espn_league.R b/R/espn_league.R index dd6fde33..a88007af 100644 --- a/R/espn_league.R +++ b/R/espn_league.R @@ -6,10 +6,7 @@ #' #' @examples #' \donttest{ -#' conn <- espn_connect( -#' season = 2020, -#' league_id = 899513 -#' ) +#' conn <- espn_connect(season = 2020, league_id = 899513) #' ff_league(conn) #' } #' diff --git a/R/mfl_starters.R b/R/mfl_starters.R index ed19f992..3bbcb704 100644 --- a/R/mfl_starters.R +++ b/R/mfl_starters.R @@ -12,17 +12,17 @@ #' @examples #' \donttest{ #' dlf_conn <- mfl_connect(2020, league_id = 37920) -#' ff_starters(conn = dlf_conn, week = 1:2) +#' ff_starters(conn = dlf_conn) #' } #' #' @export -ff_starters.mfl_conn <- function(conn, week = "all", season = NULL, ...) { +ff_starters.mfl_conn <- function(conn, week = 1:17, season = NULL, ...) { if (is.null(season)) season <- conn$season - checkmate::assert_numeric(week, lower = 1, upper = 21) + checkmate::assert_number(week, lower = 1, upper = 21) checkmate::assert_number(season) - players_endpoint <- sleeper_players() %>% + players_endpoint <- mfl_players() %>% dplyr::select("player_id", "player_name", "pos", "team") franchises_endpoint <- ff_franchises(conn) %>% diff --git a/man/ff_league.Rd b/man/ff_league.Rd index 7df64bfd..0c71f7ed 100644 --- a/man/ff_league.Rd +++ b/man/ff_league.Rd @@ -41,10 +41,7 @@ This function returns a tidy dataframe of common league settings, including deta \examples{ \donttest{ -conn <- espn_connect( - season = 2020, - league_id = 899513 -) +conn <- espn_connect(season = 2020, league_id = 899513) ff_league(conn) } diff --git a/man/ff_starters.Rd b/man/ff_starters.Rd index d2dcbe6d..d194245e 100644 --- a/man/ff_starters.Rd +++ b/man/ff_starters.Rd @@ -12,7 +12,7 @@ ff_starters(conn, ...) \method{ff_starters}{flea_conn}(conn, week = 1:17, ...) -\method{ff_starters}{mfl_conn}(conn, week = "all", season = NULL, ...) +\method{ff_starters}{mfl_conn}(conn, week = 1:17, season = NULL, ...) \method{ff_starters}{sleeper_conn}(conn, week = 1:17, ...) } @@ -48,7 +48,7 @@ ff_starters(conn) \donttest{ dlf_conn <- mfl_connect(2020, league_id = 37920) -ff_starters(conn = dlf_conn, week = 1:2) +ff_starters(conn = dlf_conn) } \donttest{