rubyforgood / rubyforgood/awbw

Backfill facilitator affiliation start dates from legacy member_since

Open
#2,284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

database cleanup facilitator-profile
Dominant language
Ruby
Stars
15
Forks
26
Avg merge
12h 42m
Merged PRs (30d)
242

Description

Problem

Facilitator start dates now come from affiliation records, but the profile/decorator still falls back to the legacy member_since column when a Facilitator affiliation has no start_date:

  • PersonDecorator#facilitator_since_dateaffiliations.facilitators.minimum(:start_date) || member_since (app/decorators/person_decorator.rb).

So where a facilitator's affiliations are missing start dates, the displayed "Facilitator since" is driven by member_since rather than the affiliation data. The edit form already flags the mismatch (member_since_earlier_than_facilitator_affiliations? / member_since_differs_from_facilitator_affiliations?), which shows these two sources disagree in production data.

The result: the affiliation records and the profile displays can be out of sync, and the "Affiliated since" grey note (added in #2280) only reads correctly once affiliation dates are trustworthy.

Goal

Make the affiliation data the single source of truth so member_since is no longer needed as a fallback for facilitators.

Scope / questions to settle

  • Backfill direction: for facilitators whose Facilitator affiliation(s) have a blank start_date, populate it from member_since (the earliest sensible value).
  • Conflicts: decide what to do when member_since is earlier than or differs from an existing affiliation start date — earlier likely means an affiliation record is missing that stretch; a plain difference may just be legacy noise. Don't clobber real affiliation start dates.
  • Idempotent migration/rake task with a dry-run report of what would change (counts of: blank→filled, member_since earlier than all facilitator affiliations, member_since differs), reviewable before running against prod.
  • After backfill: confirm the member_since fallback in facilitator_since_date can be removed (or is only hit by legacy edge cases), and drop the form warnings once the data is clean.

Notes

  • Related display work: #2280 (affiliated-since grey note).
  • Same pattern likely applies to org-level program dates (OrganizationDecorator#program_since_date) and the org start_date fallback — worth checking in the same pass.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/decorators/person_decorator.rb and the facilitator_since_date fallback, then review the affiliation start-date checks named in the issue. Define the conflict handling and inspect the related organization fallback before implementing an idempotent migration or rake task with a dry-run report. Done means missing dates are backfilled without clobbering existing dates, the report is reviewable, and the fallback and warnings are reassessed.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend, database
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.