ffverse / ffscrapr

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

ff_starters() is missing data on no-opponent weeks in 2022. #393

Open TheMathNinja opened 1 year ago

TheMathNinja commented 1 year ago

Describe the bug ff_starters() function is skipping submitted starters in 2022 MFL league in some cases (apparently, when the franchise starting them does not have a weekly opponent, e.g. a Playoff Bye)

Reprex ff_starters(mfl_connect(season = 2022, league_id = 22686, user_agent = "mikeyfili", rate_limit_number = 3, rate_limit_seconds = 6), 1:16, 2022)

`mfl_connect(season = 2022, league_id = 22686, user_agent = "mikeyfili", rate_limit_number = 3, rate_limit_seconds = 6)`

Expected behavior The above function should show that Patrick Mahomes had starts for Chicago Bears franchise in Weeks 13 and 14. However, this data is simply missing from the df, presumably because the Chicago Bears franchise did not have a weekly opponent (on account of Playoff bye) in weeks 13 or 14. They did, however, submit starting lineups with Mahomes as starter. This appears to be happening for all starters on such teams in this league for the weeks they didn't have weekly opponents. As far as I can tell, this problem is not occurring in 2021 MFL with the same league ID. Not sure why it's a "new issue" in 2022 leagues.

Session information Please copy the output of ffscrapr::ffverse_sitrep() into the box below.

── System Info ────────────────────────────────────────────────────────────────── 
• R version 4.2.2 (2022-10-31 ucrt)   • Running under: Windows 10 x64 (build 22621) 
── ffverse Packages ─────────────────────────────────────────────────────────────
 • ffscrapr (1.4.8) 
── ffverse Options ────────────────────────────────────────────────────────────── 
No options set for ffscrapr 
── ffverse Dependencies ───────────────────────────────────────────────────────── 

• askpass    (1.1)     • glue      (1.6.2)  • rappdirs   (0.3.3)    • assertthat (0.2.1)   • httr      (1.4.4)  • ratelimitr (0.4.1)    • backports  (1.4.1)   • jsonlite  (1.8.4)  • rlang      (1.0.6)    • cachem     (1.0.6)   • lifecycle (1.0.3)  • stringi    (1.7.12)   • checkmate  (2.1.0)   • magrittr  (2.0.3)  • stringr    (1.5.0)    • cli        (3.4.1)   • memoise   (2.0.1)  • sys        (3.4.1)    • cpp11      (0.4.3)   • mime      (0.12)   • tibble     (3.1.8)    • curl       (4.3.3)   • nflreadr  (1.3.2)  • tidyr      (1.3.0)    • data.table (1.14.6)  • openssl   (2.0.5)  • tidyselect (1.2.0)    • dplyr      (1.1.0)   • pillar    (1.8.1)  • utf8       (1.2.3)    • fansi      (1.0.4)   • pkgconfig (2.0.3)  • vctrs      (0.5.2)    • fastmap    (1.1.0)   • purrr     (1.0.1)  • withr      (2.5.0)    • generics   (0.1.3)   • R6        (2.5.1)     

─────────────────────────────────────────────────────────────────────────────────

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

tanho63 commented 1 year ago

API changed to not return bye weeks as matchups.

ffscrapr::mfl_getendpoint(
   ffscrapr::mfl_connect(season = 2022, league_id = 22686), "weeklyResults", W = week, YEAR = year) |> 
   purrr::pluck("content", "weeklyResults") |> 
   str(max.level = 2)
# List of 3
# $ matchup  :List of 14
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
#  ..$ :List of 2
# $ franchise:List of 4
#  ..$ :List of 7
#  ..$ :List of 7
#  ..$ :List of 7
#  ..$ :List of 7
# $ week     : chr "13"

No timeline on when I'll be able to get to this but it seems solvable.

TheMathNinja commented 1 year ago

And API changes don’t affect previous seasons?

tanho63 commented 1 year ago

Apparently not.

TheMathNinja commented 1 year ago

Should I be expecting more like weeks or months or years? 🤣

TheMathNinja commented 1 year ago

MFL informed that this was actually because I didn't have the matchup listed as "Team X vs. Bye" for that week. Apparently that makes as difference on their end. But still this API is different than what they show starts-wise on their reports.