`ff_scoring()` not working for MFL league with thresholdPoints
Describe the bug Running ff_playerscores() now returns an error for my MFL league.
Reprex
library(ffscrapr)
library(nflverse)
library(tidyverse)
FAFL22 <- mfl_connect(season = 2022, league_id = 22686, rate_limit_number = 3, rate_limit_seconds = 6)
ffscrapr::ff_playerscores(FAFL22,
season = 2022,
week = 1:17)
# Please include the code used for the connection object from `ff_connect()`
Expected behavior
I expect it to return a df, but I'm getting an error:
Error in dplyr::mutate():
ℹ In argument: rule = purrr::map(.data$rule, parse_rule).
Caused by error in purrr::map():
ℹ In index: 10.
Caused by error in mutate():
ℹ In argument: thresholdPoints = (structure(function (..., .x = ..1, .y = ..2, . = ..1) ....
Caused by error:
! thresholdPoints must be size 12 or 1, not 5.
Session information
Please copy the output of ffscrapr::ffverse_sitrep() into the box below.
Warning: unable to access index for repository https://packagemanager.posit.co/cran/latest/src/contrib:
cannot open URL 'https://packagemanager.posit.co/cran/latest/src/contrib/PACKAGES'
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'
── System Info ────────────────────────────────────────────────────────────
• R version 4.3.1 (2023-06-16 ucrt) • Running under: Windows 11 x64 (build 22621)
── Package Status ─────────────────────────────────────────────────────────
package installed cran dev behind
1 ffscrapr 1.4.8.11 1.4.8 1.4.8.11
── Package Options ────────────────────────────────────────────────────────
• No options set for above packages
── Package Dependencies ───────────────────────────────────────────────────
• askpass (1.1) • jsonlite (1.8.7) • stringr (1.5.0)
• assertthat (0.2.1) • lifecycle (1.0.3) • sys (3.4.2)
• backports (1.4.1) • magrittr (2.0.3) • tibble (3.2.1)
• cachem (1.0.8) • memoise (2.0.1) • tidyr (1.3.0)
• checkmate (2.2.0) • mime (0.12) • tidyselect (1.2.0)
• cli (3.6.1) • nflreadr (1.4.0) • utf8 (1.2.3)
• cpp11 (0.4.6) • openssl (2.1.0) • vctrs (0.6.3)
• curl (5.0.2) • pillar (1.9.0) • withr (2.5.0)
• data.table (1.14.8) • pkgconfig (2.0.3) • graphics (4.3.1)
• dplyr (1.1.2) • purrr (1.0.2) • grDevices (4.3.1)
• fansi (1.0.4) • R6 (2.5.1) • methods (4.3.1)
• fastmap (1.1.1) • rappdirs (0.3.3) • stats (4.3.1)
• generics (0.1.3) • ratelimitr (0.4.1) • tools (4.3.1)
• glue (1.6.2) • rlang (1.1.1) • utils (4.3.1)
• httr (1.4.7) • stringi (1.7.12)
── Not Installed ──────────────────────────────────────────────────────────
• ffsimulator • ffpros • ffopportunity
───────────────────────────────────────────────────────────────────────────
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Looks related to #414. Definitely an API change I think. I’m away til Tuesday next week, I’ll try to get to it around then.
I’ll probably track it in 414 since that’s more specific to ff_scoring
Looks like different issue, so reopening this again. Is thresholdPoints a new addition to the scoring for this year?
Thanks so much for working on this @tanho63!
Any updates on this one? Is it pretty complex?
Yeah, somewhat complex. Limiting factor is lack developer time though
Hey all, I’m picking this up again with @TheMathNinja. Looks like one workaround is just to use the prod branch (1.4.8) instead of the dev branch head (1.4.8.17); on prod, ff_playerscores() (the original use case) appears to run just fine, dev reproduces the original error. Any idea which commit on the dev branch could cause this divergence? I’m a far cry from an R developer, but happy to help hack in a fix where I can.
@rlynch91 Any chance you could get to the bottom of this thing this month?
Hi all, I haven’t dug too much into this issue since last commenting back in April re my workaround. To summarize for all: @TheMathNinja and I have been running with the prod branch (1.4.8), and everything has been working fine since on MFL. It was the dev branch head at the time (1.4.8.17) that had a broken ff_playerscores() on MFL. This has been a fine workflow for us in the short term, but it would be nice to get synced back up with head. @tanho63, any idea which commit in between those could have caused this issue we’re seeing on MFL? I haven’t been able to pinpoint it in the limited time I’ve had to look at this, but the hope would be that there’s a low-hanging hack there to leverage the compatibility of prod 1.4.8.
Unsure, you'd need to use git bisect a bunch probably. My guess it's this commit for new dplyr compatibility: https://github.com/ffverse/ffscrapr/commit/b2dc63aa7b34a4bb9c9eaccb60f68ea6fb95d189
This can't be fixed via a reversion, so it'll need to be updated to handle the new dplyr rectangling output.