ffverse / ffscrapr

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

ff_starter_positions.sleeper does not return data for league that is missing base position starters #400

Closed mcarman8 closed 1 year ago

mcarman8 commented 1 year ago

Describe the bug When using ffs_starter_positions to get lineup constraints, it will not return positions that do not have a dedicated position. For a league that only uses flex positions, this means no positions get returned, or a league where TE only appear in flex positions, TEs do not get returned.

Reprex

#League with only FLEX and SUPER_FLEX
conn <- sleeper_connect(season = 2023, league_id = "923802429987151872")
lineup_constraints <- ffs_starter_positions(conn)
print(lineup_constraints)

#League with QB,RB, and WR specific lineup positions but not TE
conn <- sleeper_connect(season = 2023, league_id = "919288083936329728")
lineup_constraints <- ffs_starter_positions(conn)
print(lineup_constraints)

Expected behavior I expected both lineup_constraints to contain 4 rows, one for each of QB, RB, WR, and TE.

Session information

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] plotly_4.10.2         httr_1.4.6            ffscrapr_1.4.8        digest_0.6.32        
 [5] nflreadr_1.3.2        nflfastR_4.5.1        jsonlite_1.8.5        gridtext_0.1.5       
 [9] ggpubr_0.6.0          tictoc_1.2            ggpmisc_0.5.3         ggpp_0.5.2           
[13] devtools_2.4.5        usethis_2.2.2         RCurl_1.98-1.12       extrafont_0.19       
[17] ggbeeswarm_0.7.2      ggimage_0.3.3         ggrepel_0.9.3         ggridges_0.5.4       
[21] ggforce_0.4.1         teamcolors_0.0.4      ggtext_0.1.2          gtExtras_0.4.5       
[25] ggthemes_4.2.4        DT_0.28               gt_0.9.0              lubridate_1.9.2      
[29] forcats_1.0.0         stringr_1.5.0         dplyr_1.1.2           purrr_1.0.1          
[33] readr_2.1.4           tidyr_1.3.0           tibble_3.2.1          ggplot2_3.4.2        
[37] tidyverse_2.0.0       shinycssloaders_1.0.0 shinyjs_2.1.0         future_1.33.0        
[41] promises_1.2.0.1      ffsimulator_1.2.3     shiny_1.7.4.1        

loaded via a namespace (and not attached):
  [1] rstudioapi_0.15.0  magrittr_2.0.3     magick_2.7.4       farver_2.1.1       fs_1.6.2          
  [6] vctrs_0.6.3        memoise_2.0.1      paletteer_1.5.0    janitor_2.2.0      rstatix_0.7.2     
 [11] htmltools_0.5.5    polynom_1.4-1      curl_5.0.1         broom_1.0.5        xgboost_1.7.5.1   
 [16] gridGraphics_0.5-1 sass_0.4.6         parallelly_1.36.0  bslib_0.5.0        htmlwidgets_1.6.2 
 [21] fontawesome_0.5.1  cachem_1.0.8       mime_0.12          lifecycle_1.0.3    pkgconfig_2.0.3   
 [26] Matrix_1.5-4.1     R6_2.5.1           fastmap_1.1.1      snakecase_0.11.0   colorspace_2.1-0  
 [31] furrr_0.3.1        rematch2_2.1.2     ps_1.7.5           pkgload_1.3.2.1    crosstalk_1.2.0   
 [36] progressr_0.13.0   fansi_1.0.4        timechange_0.2.0   mgcv_1.8-42        abind_1.4-5       
 [41] polyclip_1.10-4    compiler_4.3.1     remotes_2.4.2      withr_2.5.0        backports_1.4.1   
 [46] carData_3.0-5      pkgbuild_1.4.2     Rttf2pt1_1.3.12    ggsignif_0.6.4     MASS_7.3-60       
 [51] quantreg_5.95      sessioninfo_1.2.2  tools_4.3.1        vipor_0.4.5        beeswarm_0.4.0    
 [56] httpuv_1.6.11      extrafontdb_1.0    glue_1.6.2         callr_3.7.3        nlme_3.1-162      
 [61] grid_4.3.1         checkmate_2.2.0    generics_0.1.3     gtable_0.3.3       ratelimitr_0.4.1  
 [66] tzdb_0.4.0         data.table_1.14.8  hms_1.1.3          car_3.1-2          xml2_1.3.4        
 [71] utf8_1.2.3         pillar_1.9.0       yulab.utils_0.0.6  later_1.3.1        splines_4.3.1     
 [76] tweenr_2.0.2       lattice_0.21-8     survival_3.5-5     SparseM_1.81       tidyselect_1.2.0  
 [81] miniUI_0.1.1.1     fastrmodels_1.0.2  stringi_1.7.12     yaml_2.3.7         lazyeval_0.2.2    
 [86] ggfun_0.1.1        codetools_0.2-19   ggplotify_0.1.1    cli_3.6.1          xtable_1.8-4      
 [91] jquerylib_0.1.4    munsell_0.5.0      processx_3.8.1     Rcpp_1.0.10        globals_0.16.2    
 [96] parallel_4.3.1     MatrixModels_0.5-1 ellipsis_0.3.2     assertthat_0.2.1   prettyunits_1.1.1 
[101] profvis_0.3.8      urlchecker_1.0.1   bitops_1.0-7       listenv_0.9.0      viridisLite_0.4.2 
[106] scales_1.2.1       crayon_1.5.2       rlang_1.1.1
tanho63 commented 1 year ago

relocated to ffscrapr since the root cause is ffscrapr::ff_starter_positions() not having the desired behaviour