Skip to content
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.19
Version: 1.4.8.20
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 @@ -30,6 +30,7 @@ row per player-team-season (v1.4.8.13) (thanks @john-b-edwards!)
- [BREAKING] `mfl_players()` and `sleeper_players()` outputs now try to return
more standardized column types (v1.4.8.17)
- `sleeper_userleagues()` output has a new column roster_id which is the same ID as franchise_id in `sleeper_rosters()` (1.4.8.19) (#436)
- `mfl_transactions()` now processes `transaction_type = "WAIVER"` (1.4.8.20) (#438)

# ffscrapr 1.4.8

Expand Down
36 changes: 34 additions & 2 deletions R/mfl_transactions.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ ff_transactions.mfl_conn <- function(conn, transaction_type = "*", ...) {
injured_reserve = .mfl_transactions_injuredreserve,
taxi_squad = .mfl_transactions_taxisquad,
bbid_waiver = .mfl_transactions_bbid_waiver,
trade = .mfl_transactions_trade
trade = .mfl_transactions_trade,
fcfs_waiver = .mfl_transactions_fcfs_waiver
)

players_endpoint <- mfl_players(conn) %>%
Expand Down Expand Up @@ -274,8 +275,39 @@ ff_transactions.mfl_conn <- function(conn, transaction_type = "*", ...) {
dplyr::arrange(dplyr::desc(.data$timestamp))
}

## WAIVER - FCFS ##
# Create a tibble where each waiver fcfs transaction is represented on one line
#' @noRd
#' @keywords internal

.mfl_transactions_fcfs_waiver <- function(df_transactions) {
fcfs_transactions <- df_transactions %>%
dplyr::filter(.data$type == "WAIVER")

if (nrow(fcfs_transactions) == 0) {
return(NULL)
}

parsed_fcfs <- fcfs_transactions %>%
dplyr::select("timestamp", "type", "dropped", "added", "franchise", "comments") %>%
dplyr::mutate_at(c("added", "dropped"), ~ stringr::str_replace(.x, ",$", "")) %>%
tidyr::pivot_longer(c("added", "dropped"), names_to = "type_desc", values_to = "player_id") %>%
tidyr::separate_rows("player_id", sep = ",") %>%
dplyr::filter(.data$player_id != "")

parsed_fcfs %>%
dplyr::select(
"timestamp",
"type",
"franchise",
"type_desc",
"player_id",
"comments"
) %>%
dplyr::arrange(dplyr::desc(.data$timestamp))
}

## Will need to write functions to parse each of these, then row bind them back together afterwards.
# WAIVER - FCFS
# BBID_AUTO_PROCESS_WAIVERS
# WAIVER_REQUEST
# BBID_WAIVER_REQUEST
Expand Down
2 changes: 2 additions & 0 deletions man/dp_clean_names.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.