Skip to content

Add monthly guards to scheduled rake tasks (#7284) - #7329

Open
KoushikSagarr wants to merge 1 commit into
rubyforgood:mainfrom
KoushikSagarr:7284-monthly-rake-guards
Open

KoushikSagarr wants to merge 1 commit into
rubyforgood:mainfrom
KoushikSagarr:7284-monthly-rake-guards

Conversation

@KoushikSagarr

@KoushikSagarr KoushikSagarr commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What github issue is this PR for, if any?

Resolves [#7284]

What changed, and why?

  • Added a day-of-month guard to the youth birthday reminder task so it only executes on the 15th of each month.
  • Added a day-of-month guard to the monthly learning hours report task so it only executes on the 1st of each month.
  • Added FORCE=true overrides to both tasks to allow manual execution outside their scheduled days.
  • Updated both task descriptions to clarify that they can run daily through Heroku Scheduler while only performing their work on the designated day.
  • Added and updated RSpec coverage for scheduled execution, skipped execution, forced execution, and eligible report recipients.
  • Kept changes strictly limited to the two rake task files and their corresponding specs.

This is another small, independently reviewable contribution toward making CASA's scheduled tasks reliable and compatible with Heroku Scheduler.

How is this tested? (please write rspec and jest tests!) 💖💪

  • StandardRB: 0 offenses across all four changed files.
  • RSpec: 12 examples, 0 failures, 0 pending across both rake task specs.
  • Time travel: Verified Rails travel_to state is restored between examples.
  • Environment isolation: Verified FORCE environment stubbing is restored after each example.
  • Rake tasks: Verified tasks are re-enabled correctly between repeated invocations.
  • Git diff: git diff --check passed with no whitespace errors.
  • Jest: Not applicable — this change involves Ruby rake tasks and RSpec tests.

Screenshots please :)

Not applicable — this change affects backend task scheduling and has no user-facing UI.

Feelings gif (optional)

Making scheduled tasks behave exactly when they're supposed to. One more clean contribution! 💪

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Touches Ruby code 🧪 Tests Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant