Skip to content

Backfill facilitator affiliation start dates from legacy member_since #2284

Description

@maebeale

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions