From ce945bb2147fc837bb963594fe6f2edba7c8900b Mon Sep 17 00:00:00 2001 From: Randal Morris Date: Thu, 24 Aug 2023 18:27:21 -0500 Subject: [PATCH 1/2] Fixed ff_draft.flea_conn to work again --- DESCRIPTION | 2 +- NEWS.md | 1 + R/flea_draft.R | 30 +++++++++++++++--------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 43bfb9b32..ce76f5eb5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.8.10 +Version: 1.4.8.11 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index 7cffc6e32..2ae5a09ec 100644 --- a/NEWS.md +++ b/NEWS.md @@ -19,6 +19,7 @@ and keep NA data where a player is not in a slot. (v1.4.8.07) (v1.4.8.10) - Use rlang::ns_env rather than superassign in onLoad - Refactor testing +- `ff_draft.flea_conn` is fixed to pull draft data again (v1.4.8.11) # ffscrapr 1.4.8 diff --git a/R/flea_draft.R b/R/flea_draft.R index 07c010ce3..ab8ec908e 100644 --- a/R/flea_draft.R +++ b/R/flea_draft.R @@ -18,22 +18,22 @@ #' @export ff_draft.flea_conn <- function(conn, ...) { draftboard <- fleaflicker_getendpoint("FetchLeagueDraftBoard", - sport = "NFL", - season = conn$season, - league_id = conn$league_id - ) %>% - purrr::pluck("content", "orderedSelections") %>% + sport = "NFL", + season = conn$season, + league_id = conn$league_id) %>% + purrr::pluck("content", "rows") %>% tibble::tibble() %>% - tidyr::hoist(1, "franchise" = "team", "player", "slot") %>% - tidyr::hoist("slot", "round", "pick" = "slot", "overall") %>% - tidyr::hoist("franchise", "franchise_id" = "id", "franchise_name" = "name") %>% - dplyr::mutate(player = purrr::map(.data$player, purrr::pluck, "proPlayer")) %>% - tidyr::hoist("player", - "player_id" = "id", - "player_name" = "nameFull", - "pos" = "position", - "team" = "proTeamAbbreviation" - ) %>% + tidyr::hoist(1,"round", "cells") %>% + tidyr::unnest_longer("cells") %>% + tidyr::hoist("cells", "team", "player", "slot") %>% + tidyr::hoist("team", "franchise_id" = "id", + "franchise_name" = "name") %>% + tidyr::hoist("player", "proPlayer") %>% + tidyr::hoist("proPlayer", "player_id" = "id", + "player_name" = "nameFull", + "pos" = "position", + "team" = "proTeamAbbreviation") %>% + tidyr::hoist("slot", "pick_no" = "slot", "overall") %>% dplyr::select(dplyr::any_of(c( "round", "pick", From b1b45bfafc8277be6f261139de66c1481d021eaa Mon Sep 17 00:00:00 2001 From: Randal Morris Date: Thu, 24 Aug 2023 19:10:30 -0500 Subject: [PATCH 2/2] Adjust pick to old code --- R/flea_draft.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/flea_draft.R b/R/flea_draft.R index ab8ec908e..0f053e37f 100644 --- a/R/flea_draft.R +++ b/R/flea_draft.R @@ -33,7 +33,7 @@ ff_draft.flea_conn <- function(conn, ...) { "player_name" = "nameFull", "pos" = "position", "team" = "proTeamAbbreviation") %>% - tidyr::hoist("slot", "pick_no" = "slot", "overall") %>% + tidyr::hoist("slot", "pick" = "slot", "overall") %>% dplyr::select(dplyr::any_of(c( "round", "pick",