Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ff_draft.flea_conn to work again #411

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.8.10
Version: 1.4.8.11
Authors@R:
c(person(given = "Tan",
family = "Ho",
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
30 changes: 15 additions & 15 deletions R/flea_draft.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down