ffverse / ffscrapr

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

ff_schedule Failing to Pull Certain Matchups #407

Closed mhogan16 closed 11 months ago

mhogan16 commented 11 months ago

Describe the bug ff_schedule() doesn't seem to pull matchups prior to week 11, but only for the 2018 and 2019 seasons. It works just fine for 2020, 2021, and 2022.

Reprex Included is the 2018 and 2019 mfl_connect, a schedule pull with a week filter, as well as a schedule pull without a week filter.

> fsn96_19 <- mfl_connect(2019,16055)
> fsn96_18 <- mfl_connect(2018,16055)
> 
> ff_schedule(fsn96_19) %>%
+   select(franchise_id,week,score = franchise_score,result:opponent_score) %>%
+   filter(week <= 11) %>%
+   mutate(h2h_w = ifelse(result == "W", 1, 0),
+          h2h_l = ifelse(result == "L", 1, 0),
+          h2h_t = ifelse(result == "T", 1, 0))
# A tibble: 0 × 9
# ℹ 9 variables: franchise_id <chr>, week <dbl>, score <dbl>, result <chr>, opponent_id <chr>,
#   opponent_score <dbl>, h2h_w <lgl>, h2h_l <lgl>, h2h_t <lgl>
> 
> ff_schedule(fsn96_19) %>%
+   select(franchise_id,week,score = franchise_score,result:opponent_score) %>%
+   mutate(h2h_w = ifelse(result == "W", 1, 0),
+          h2h_l = ifelse(result == "L", 1, 0),
+          h2h_t = ifelse(result == "T", 1, 0))
# A tibble: 118 × 9
   franchise_id  week score result opponent_id opponent_score h2h_w h2h_l h2h_t
   <chr>        <dbl> <dbl> <chr>  <chr>                <dbl> <dbl> <dbl> <dbl>
 1 0001            12  157. W      0054                  94.1     1     0     0
 2 0003            12  181. W      0053                  86.5     1     0     0
 3 0005            12  146. L      0045                 152.      0     1     0
 4 0007            12  119. L      0036                 176.      0     1     0
 5 0008            12  140. W      0019                  78.1     1     0     0
 6 0009            12  102. L      0061                 109.      0     1     0
 7 0011            12  138. W      0059                 129.      1     0     0
 8 0013            12  123. L      0069                 148.      0     1     0
 9 0014            12  123. W      0023                 100.      1     0     0
10 0015            12  126. L      0082                 181.      0     1     0
# ℹ 108 more rows
# ℹ Use `print(n = ...)` to see more rows
> 
> ff_schedule(fsn96_18) %>%
+   select(franchise_id,week,score = franchise_score,result:opponent_score) %>%
+   filter(week <= 11) %>%
+   mutate(h2h_w = ifelse(result == "W", 1, 0),
+          h2h_l = ifelse(result == "L", 1, 0),
+          h2h_t = ifelse(result == "T", 1, 0))
# A tibble: 0 × 9
# ℹ 9 variables: franchise_id <chr>, week <dbl>, score <dbl>, result <chr>, opponent_id <chr>,
#   opponent_score <dbl>, h2h_w <lgl>, h2h_l <lgl>, h2h_t <lgl>
> 
> ff_schedule(fsn96_18) %>%
+   select(franchise_id,week,score = franchise_score,result:opponent_score) %>%
+   mutate(h2h_w = ifelse(result == "W", 1, 0),
+          h2h_l = ifelse(result == "L", 1, 0),
+          h2h_t = ifelse(result == "T", 1, 0))
# A tibble: 118 × 9
   franchise_id  week score result opponent_id opponent_score h2h_w h2h_l h2h_t
   <chr>        <dbl> <dbl> <chr>  <chr>                <dbl> <dbl> <dbl> <dbl>
 1 0001            12  163. W      0026                  159.     1     0     0
 2 0002            12  146. W      0050                  103.     1     0     0
 3 0003            12  175. W      0025                  112.     1     0     0
 4 0004            12  109. L      0021                  146.     0     1     0
 5 0015            12  134. L      0028                  179.     0     1     0
 6 0016            12  165. W      0074                  134.     1     0     0
 7 0017            12  135. L      0067                  183.     0     1     0
 8 0019            12  179. W      0065                  144.     1     0     0
 9 0020            12  144. W      0037                  117.     1     0     0
10 0021            12  146. W      0004                  109.     1     0     0
# ℹ 108 more rows
# ℹ Use `print(n = ...)` to see more rows

Expected behavior It should pull every single game.

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.05)  • ffpros        (0.1.5)       
• ffsimulator (1.2.3)     • ffopportunity (0.1.0.06)    
── ffverse Options ──────────────────────────────────────────────────────────────────────────────────────────
• ffpros.include_metadata: FALSE
• ffpros.sport           : nfl
• ffpros.user_agent      : ffpros/0.1.5 R client package https://github.com/ffverse/ffpros
── ffverse Dependencies ─────────────────────────────────────────────────────────────────────────────────────
• askpass    (1.1)     • httr       (1.4.6)  • Rglpk      (0.6-5)   
• assertthat (0.2.1)   • jsonlite   (1.8.7)  • 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.5)   • 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 This league uses the doubleheader format, so I'm not sure if that's causing issues (though once again, it doesn't appear to have that issue for 2020+, so I'm not sure why it would cause issues specifically for 2018 and 2019).

tanho63 commented 11 months ago

Hmm. This looks like a problem on MFL side - https://www49.myfantasyleague.com/2019/api_info?STATE=test&CCAT=export&TYPE=schedule&L=16055 only returns week 11+, and 2020 doesn't have that problem.

Best to open an MFL support ticket I think, might be config issue or MFL issue.