ffverse / ffscrapr

R API Client for Fantasy Football League Platforms
https://ffscrapr.ffverse.com
Other
76 stars 21 forks source link

`ff_scoring()` not working for MFL league with thresholdPoints #413

Open TheMathNinja opened 10 months ago

TheMathNinja commented 10 months ago

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.

tanho63 commented 10 months ago

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.

tanho63 commented 10 months ago

I’ll probably track it in 414 since that’s more specific to ff_scoring

tanho63 commented 10 months ago

Looks like different issue, so reopening this again. Is thresholdPoints a new addition to the scoring for this year?

TheMathNinja commented 10 months ago

Thanks so much for working on this @tanho63!

TheMathNinja commented 8 months ago

Any updates on this one? Is it pretty complex?

tanho63 commented 8 months ago

Yeah, somewhat complex. Limiting factor is lack developer time though

rlynch91 commented 3 months ago

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.