ffverse / ffscrapr

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

Column error in ff_scoring.mfl_conn #414

Closed mcarman8 closed 1 year ago

mcarman8 commented 1 year ago

Describe the bug Error "Can't subset columns that don't exist. Column 'points' does not exist" in ff_scoring.mfl_conn

Reprex

conn <- mfl_connect(season = 2023, league_id = 66588)
scoring <- ffscrapr::ff_scoring(conn) 

Expected behavior Returns the expected scoring data.

Error Trace

<error/vctrs_error_subscript_oob>
Error in `tidyr::unnest()`:
! Can't subset columns that don't exist.
✖ Column `points` doesn't exist.
---
Backtrace:
     ▆
  1. ├─base::source("~/.active-rstudio-document")
  2. │ ├─base::withVisible(eval(ei, envir))
  3. │ └─base::eval(ei, envir)
  4. │   └─base::eval(ei, envir)
  5. ├─ffscrapr::ff_scoring(conn) at ~/.active-rstudio-document:3:0
  6. ├─ffscrapr:::ff_scoring.mfl_conn(conn)
  7. │ └─... %>% ...
  8. ├─dplyr::select(...)
  9. ├─dplyr::mutate(...)
 10. ├─dplyr::mutate_at(., c("is_player", "is_team", "is_coach"), ~as.logical(as.numeric(.x)))
 11. │ └─dplyr:::manip_at(...)
 12. │   └─dplyr:::tbl_at_syms(...)
 13. │     └─dplyr:::tbl_at_vars(...)
 14. │       └─dplyr::tbl_vars(tbl)
 15. │         ├─dplyr:::new_sel_vars(tbl_vars_dispatch(x), group_vars(x))
 16. │         │ └─base::structure(...)
 17. │         └─dplyr:::tbl_vars_dispatch(x)
 18. ├─dplyr::left_join(., mfl_allrules(conn), by = c(event = "abbrev"))
 19. ├─tidyr::separate_rows(., "positions", sep = "\\|")
 20. ├─tidyr::unnest(., c("points", "event", "range"))
 21. ├─tidyr:::unnest.data.frame(., c("points", "event", "range"))
 22. │ └─tidyselect::eval_select(expr = enquo(cols), data = data, allow_rename = FALSE)
 23. │   └─tidyselect:::eval_select_impl(...)
 24. │     ├─tidyselect:::with_subscript_errors(...)
 25. │     │ └─rlang::try_fetch(...)
 26. │     │   └─base::withCallingHandlers(...)
 27. │     └─tidyselect:::vars_select_eval(...)
 28. │       └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
 29. │         └─tidyselect:::eval_c(expr, data_mask, context_mask)
 30. │           └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 31. │             └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
 32. │               └─tidyselect:::as_indices_sel_impl(...)
 33. │                 └─tidyselect:::as_indices_impl(...)
 34. │                   └─tidyselect:::chr_as_locations(x, vars, call = call, arg = arg)
 35. │                     └─vctrs::vec_as_location(...)
 36. └─vctrs (local) `<fn>`()
 37.   └─vctrs:::stop_subscript_oob(...)
 38.     └─vctrs:::stop_subscript(...)
 39.       └─rlang::abort(...)

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

── System Info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• R version 4.3.1 (2023-06-16 ucrt)   • Running under: Windows 10 x64 (build 19045)
── ffverse Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• ffscrapr    (1.4.8)
• ffsimulator (1.2.3)
── ffverse Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
No options set for ffscrapr and ffsimulator
── ffverse Dependencies ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• askpass    (1.1)     • httr       (1.4.6)  • Rglpk      (0.6-5)   
• assertthat (0.2.1)   • jsonlite   (1.8.5)  • rlang      (1.1.1)   
• backports  (1.4.1)   • lifecycle  (1.0.3)  • slam       (0.1-50)  
• cachem     (1.0.8)   • magrittr   (2.0.3)  • stringi    (1.7.12)  
• checkmate  (2.2.0)   • memoise    (2.0.1)  • stringr    (1.5.0)   
• cli        (3.6.1)   • mime       (0.12)   • sys        (3.4.2)   
• cpp11      (0.4.4)   • nflreadr   (1.3.2)  • tibble     (3.2.1)   
• curl       (5.0.1)   • openssl    (2.1.0)  • tidyr      (1.3.0)   
• data.table (1.14.8)  • pillar     (1.9.0)  • tidyselect (1.2.0)   
• dplyr      (1.1.2)   • pkgconfig  (2.0.3)  • tidytable  (0.10.1)  
• fansi      (1.0.4)   • purrr      (1.0.1)  • utf8       (1.2.3)   
• fastmap    (1.1.1)   • R6         (2.5.1)  • vctrs      (0.6.3)   
• generics   (0.1.3)   • rappdirs   (0.3.3)  • withr      (2.5.0)   
• glue       (1.6.2)   • ratelimitr (0.4.1)    
──────────────────────────────────────────────

Additional context I am not the owner of this league, it is from someone else. If I get some extra time in the next week, I will attempt to debug this. I looked at the mfl rules api response and could not find an obvious difference that would be the cause of this error.

tanho63 commented 1 year ago

Also ff_playerscores() as reported by #413 @TheMathNinja. Looks like an API change.

tanho63 commented 1 year ago

@mcarman8 I can't repro this error, can you? (with latest devel version of ffscrapr)

mcarman8 commented 1 year ago

@tanho63 Sorry for the delay. I am unable to reproduce this error with the latest development version, only with v1.4.8 as latest available on CRAN. It appears whatever the issue is will be resolved when a new version is released.

tanho63 commented 1 year ago

Sweet, thanks