diff --git a/DESCRIPTION b/DESCRIPTION index 43bfb9b3..ce76f5eb 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 7cffc6e3..2ae5a09e 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 07c010ce..0f053e37 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" = "slot", "overall") %>% dplyr::select(dplyr::any_of(c( "round", "pick",