Skip to content

fix(fg): honor startdate/enddate date ranges (#326) + doc/check maintenance sweep - #414

Merged
saiemgilani merged 5 commits into
masterfrom
development_branch
Jul 23, 2026
Merged

fix(fg): honor startdate/enddate date ranges (#326) + doc/check maintenance sweep#414
saiemgilani merged 5 commits into
masterfrom
development_branch

Conversation

@saiemgilani

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

fg_batter_leaders(), fg_pitcher_leaders(), fg_fielder_leaders(), fg_team_batter(), fg_team_pitcher(), and fg_team_fielder() now honor startdate/enddate out of the box, plus a maintenance sweep: a roxygen @inheritParams failure fix, R CMD check NOTE cleanups, and CLAUDE.md / Copilot-instruction updates.

Type of Change

  • fix -- Bug fix (non-breaking change that fixes an issue)
  • docs -- Documentation only (roxygen, README, vignettes, NEWS)
  • test -- Adding or updating tests
  • chore -- Tooling, build, or maintenance change

Related Issues

Fixes #326.

Background & Context

FanGraphs' leaders API treats month as a modal parameter, not just a calendar month: startdate/enddate are only applied when month = "1000". With the default month = "0", a date-ranged call silently returned the full-season board — no error, just wrong data (#326).

Changes Made

  • fix(fg): the six leaderboard/team wrappers auto-set month <- "1000" when a date range is supplied and month was left at its default (""/"0"). An explicit month is never overridden. The @param month docs now cover the special values ("13" vs LHP, "14" vs RHP, "1000" date range).
  • docs(espn): dropped the failing @inheritParams espn_mlb_calendar from espn_college_baseball_calendar() — its only parameter (season) is documented locally, so roxygen2 errored with @inheritParams failed on every devtools::document() run.
  • chore: .Rbuildignore/.gitignore entries for local AI/tooling cache dirs that R CMD check flags as non-standard files.
  • docs: fixed the URLs flagged by the CRAN-feasibility NOTE (404ing stargazers badge link; http→https / moved targets in NEWS.md), and documented the modal month gotcha in CLAUDE.md + .github/copilot-instructions.md so new date-accepting FanGraphs wrappers apply the same guard.

Submission Checklist

  • devtools::document() run (man pages regenerated, no roxygen warnings)
  • NEWS.md updated
  • Tests added/updated

Testing

Verified live (2026-07-23), plus a gated regression test in test-fg_batter_leaders.R (FANGRAPHS_TESTS=1):

call rows max PA
fg_batter_leaders(startdate = "2023-03-26", enddate = "2023-04-26") (auto) 947 118
same + explicit month = "1000" 947 118
fg_batter_leaders(startseason = "2023", endseason = "2023") 1457 753

The auto and explicit calls are identical; before this fix the date-ranged call returned the full-season board (max PA 753).

Baseline rcmdcheck --as-cran on master: 0 errors / 0 warnings / 2 notes — both notes addressed here (hidden tooling dirs; invalid URLs). All 5 test-fg_batter_leaders.R tests pass live.

Additional Notes

Part of a maintenance sweep that also merged #412 (Savant miss_distance, fixing #408 + #413) and closed #405 (superseded — the okhttp-UA fix already landed on master with credit) and stale-fixed issues #306, #330, #336, #348, #360, #364, #375.

FanGraphs only applies startdate/enddate when month = "1000"; with the
default month = "0" the leaders API silently returns the full-season
board. The six leaderboard/team wrappers now set month <- "1000" when a
date range is requested without an explicit month, and the @PARAM month
docs cover the special values ("13" vs LHP, "14" vs RHP, "1000" date
range). Verified live: 2023-03-26..2023-04-26 returns the date-ranged
board (947 rows, max PA 118, identical to explicit month = "1000")
instead of the full season (1457 rows, max PA 753); gated regression
test added.
…lendar

The shim documents its only parameter (season) locally, so @inheritParams
espn_mlb_calendar had nothing left to inherit and roxygen2 errored with
"@inheritParams failed" on every devtools::document() run.
.omc, .understand-anything, R/.omc, and R/.ruff_cache are local tooling
droppings that R CMD check flags as non-standard package files.
Drop the trailing slash from the 404ing stargazers badge link and point
NEWS.md at the current https/redirect targets (stats.ncaa.org, Stathead).
@saiemgilani
saiemgilani merged commit b6f74c0 into master Jul 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better Documentation Around Fangraphs "Month" Parameter

1 participant