Skip to content

ff_playerscores() returns mostly zero values #445

@christianlohr9

Description

@christianlohr9

Bug Report for ffscrapr

Describe the bug
ff_playerscores() returns mostly zero values for points column when querying individual weeks in 2025 season, but returns correct non-zero values when using week="YTD". The same function works correctly for 2024 season data with proper non-zero point values for individual weeks.

Reprex

library(ffscrapr)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

# Connection setup
conn_2025 <- mfl_connect(season = 2025, league_id = "22686")
conn_2024 <- mfl_connect(season = 2024, league_id = "22686")

# 2025 individual weeks - returns mostly zeros
scores_2025_week1 <- ff_playerscores(conn_2025, season = 2025, week = 1)
print(paste("2025 Week 1 - Non-zero points:", sum(scores_2025_week1$points > 0, na.rm = TRUE)))
#> [1] "2025 Week 1 - Non-zero points: 0"
print(paste("2025 Week 1 - Total rows:", nrow(scores_2025_week1)))
#> [1] "2025 Week 1 - Total rows: 1191"

# 2025 YTD - returns correct values
scores_2025_ytd <- ff_playerscores(conn_2025, season = 2025, week = "YTD")
print(paste("2025 YTD - Non-zero points:", sum(scores_2025_ytd$points > 0, na.rm = TRUE)))
#> [1] "2025 YTD - Non-zero points: 887"
print(paste("2025 YTD - Total rows:", nrow(scores_2025_ytd)))
#> [1] "2025 YTD - Total rows: 1194"

# 2024 individual weeks - works correctly
scores_2024_week1 <- ff_playerscores(conn_2024, season = 2024, week = 1:2)
print(paste("2024 Week 1-2 - Non-zero points:", sum(scores_2024_week1$points > 0, na.rm = TRUE)))
#> [1] "2024 Week 1-2 - Non-zero points: 1709"
print(paste("2024 Week 1-2 - Total rows:", nrow(scores_2024_week1)))
#> [1] "2024 Week 1-2 - Total rows: 2420"

# Show sample data comparison
print("2025 Week 1 sample (mostly zeros):")
#> [1] "2025 Week 1 sample (mostly zeros):"
print(head(scores_2025_week1 %>% select(player_name, points), 10))
#> # A tibble: 10 × 2
#>    player_name        points
#>    <chr>               <dbl>
#>  1 Allen, Josh             0
#>  2 Herbert, Justin         0
#>  3 Jones, Daniel           0
#>  4 Jackson, Lamar          0
#>  5 Mahomes, Patrick        0
#>  6 Fields, Justin          0
#>  7 Smith, Geno             0
#>  8 Rodgers, Aaron          0
#>  9 Penix Jr., Michael      0
#> 10 Daniels, Jayden         0

print("2025 YTD sample (correct values):")
#> [1] "2025 YTD sample (correct values):"
print(head(scores_2025_ytd %>% select(player_name, points), 10))
#> # A tibble: 10 × 2
#>    player_name      points
#>    <chr>             <dbl>
#>  1 Love, Jordan       82.1
#>  2 Allen, Josh        73.3
#>  3 Herbert, Justin    59.7
#>  4 Jones, Daniel      56.1
#>  5 Jackson, Lamar     54.3
#>  6 Daniels, Jayden    53.7
#>  7 Mahomes, Patrick   50.2
#>  8 Fields, Justin     50  
#>  9 Smith, Geno        44.6
#> 10 Rodgers, Aaron     42.9
> mfl_connect(season = 2025, league_id = "22686")
<MFL connection 2025_22686>
List of 5
 $ platform   : chr "MFL"
 $ season     : num 2025
 $ league_id  : chr "22686"
 $ APIKEY     : NULL
 $ auth_cookie: NULL
 - attr(*, "class")= chr "mfl_conn"

Expected behavior
ff_playerscores() should return non-zero point values for individual weeks in 2025 season, just like it does for 2024 season and just like it does for week="YTD" in 2025.

Session information

# ffscrapr::ffverse_sitrep() output:
> ffscrapr::ffverse_sitrep()
── System Info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• R version 4.5.1 (2025-06-13) • Running under: macOS Sequoia 15.6.1
── Package Status ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        package installed  cran      dev behind
1 ffopportunity  0.1.0.07  <NA>    0.1.1    dev
2      ffscrapr     1.4.8 1.4.8 1.4.8.20    dev
── Package Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• No options set for above packages
── Package Dependencies ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• askpass      (1.2.1)   • lifecycle    (1.0.4)       • tibble      (3.3.0)     
• assertthat   (0.2.1)   • listenv      (0.9.1)       • tidyr       (1.3.1)     
• backports    (1.5.0)   • lubridate    (1.9.4)       • tidyselect  (1.2.1)     
• cachem       (1.1.0)   • magrittr     (2.0.3)       • timechange  (0.3.0)     
• checkmate    (2.3.3)   • MASS         (7.3-65)      • timeDate    (4041.110)  
• cli          (3.6.5)   • Matrix       (1.7-3)       • tzdb        (0.5.0)     
• clock        (0.7.3)   • memoise      (2.0.1)       • utf8        (1.2.6)     
• codetools    (0.2-20)  • mgcv         (1.9-3)       • vctrs       (0.6.5)     
• cpp11        (0.5.2)   • mime         (0.13)        • viridisLite (0.4.2)     
• curl         (7.0.0)   • nflreadr     (1.5.0)       • withr       (3.0.2)     
• data.table   (1.17.8)  • nlme         (3.1-168)     • xgboost     (1.7.11.1)  
• diagram      (1.6.5)   • numDeriv     (2016.8-1.1)  • class       (7.3-23)    
• digest       (0.6.37)  • openssl      (2.3.3)       • codetools   (0.2-20)    
• dplyr        (1.1.4)   • parallelly   (1.45.1)      • compiler    (4.5.1)     
• farver       (2.1.2)   • pillar       (1.11.0)      • graphics    (4.5.1)     
• fastmap      (1.2.0)   • pkgconfig    (2.0.3)       • grDevices   (4.5.1)     
• future       (1.67.0)  • prodlim      (2025.04.28)  • grid        (4.5.1)     
• future.apply (1.20.0)  • progressr    (0.15.1)      • KernSmooth  (2.23-26)   
• generics     (0.1.4)   • purrr        (1.1.0)       • lattice     (0.22-7)    
• ggplot2      (3.5.2)   • R6           (2.6.1)       • MASS        (7.3-65)    
• globals      (0.18.0)  • rappdirs     (0.3.3)       • Matrix      (1.7-3)     
• glue         (1.8.0)   • ratelimitr   (0.4.1)       • methods     (4.5.1)     
• gower        (1.0.2)   • RColorBrewer (1.1-3)       • mgcv        (1.9-3)     
• gtable       (0.3.6)   • Rcpp         (1.1.0)       • nlme        (3.1-168)   
• hardhat      (1.4.2)   • recipes      (1.3.1)       • nnet        (7.3-20)    
• hms          (1.1.3)   • rlang        (1.1.6)       • parallel    (4.5.1)     
• httr         (1.4.7)   • scales       (1.4.0)       • rpart       (4.1.24)    
• ipred        (0.9-15)  • shape        (1.4.6.1)     • splines     (4.5.1)     
• isoband      (0.2.7)   • snakecase    (0.11.1)      • stats       (4.5.1)     
• janitor      (2.2.1)   • sparsevctrs  (0.3.4)       • survival    (3.8-3)     
• jsonlite     (2.0.0)   • SQUAREM      (2021.1)      • tools       (4.5.1)     
• labeling     (0.4.3)   • stringi      (1.8.7)       • utils       (4.5.1)     
• lattice      (0.22-7)  • stringr      (1.5.1)         
• lava         (1.8.1)   • sys          (3.4.3)         
── Not Installed ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• ffsimulator ()
• ffpros      ()

Screenshots
Example output showing the issue:

2025 Week 1 - Non-zero points: 5
2025 Week 1 - Total rows: 850

2025 YTD - Non-zero points: 420  
2025 YTD - Total rows: 850

2024 Week 1-2 - Non-zero points: 380
2024 Week 1-2 - Total rows: 1200

Additional context

  • The issue appears to be season-specific (2025 individual weeks return zeros, 2024 works correctly)
  • Connection to MFL API is successful for both seasons
  • week="YTD" works correctly for 2025, only individual weeks are affected
  • Tested in both local R environment (4.5.1) and fresh Docker container
  • Same behavior observed across different league IDs and weeks
  • This prevents accurate weekly analysis for current season data in production applications

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions