Skip to content

Rework org status: remove program status, merged affiliated-since, 3-value status#1993

Open
maebeale wants to merge 3 commits into
mainfrom
maebeale/remove-org-status-columns
Open

Rework org status: remove program status, merged affiliated-since, 3-value status#1993
maebeale wants to merge 3 commits into
mainfrom
maebeale/remove-org-status-columns

Conversation

@maebeale

@maebeale maebeale commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 5 Inspect 🔬 substantive display logic (affiliation-period merging, mirrored in JS) plus a data migration that remaps + drops OrganizationStatus records

What is the goal of this PR and why is this important?

Three related cleanups to org data that only made sense together:

  • Program status (New/Reinstate/Ongoing) is event-relative, so it's removed from the org-wide index column and edit form (per-event version lives on the profile in Add Event abbreviation and surface it in compact/event contexts #1995).
  • "Affiliated since" now reflects the real shape of an org's affiliation history — merged periods with gaps — instead of one flat Mon YYYY – Mon YYYY range.
  • The org status vocabulary is trimmed from six event-flavored values to Active / Formerly active / Unknown.

How did you approach the change?

  • Removals: the index "Program" column, the orphaned Organization.program_statuses_by_id, and the edit-form "Program status" block.
  • AffiliationPeriods service merges affiliation intervals into periods: a lone ongoing period → "Mon YYYY" (this year) or its start year; multi-period lists are year-only → "2010-2012, 2026". Falls back to org.start_date, then blank. Applied on show / index / edit; the edit form's live JS preview mirrors the same formatting.
  • Status simplification: constant + a data migration remaps existing statuses (Reinstate→Active, Inactive/Suspended→Formerly active, Pending→Unknown) then deletes the retired records. The affiliation status-sync callback and seeds follow the new names.

Anything else to add?

  • The DB organization_status search filter is kept (real field).
  • Screenshots to follow.

Copilot AI review requested due to automatic review settings July 15, 2026 04:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

# already-loaded affiliations so a profile can classify many events without an
# N+1. No facilitator affiliation starting before the date => :new; an earlier
# one still active on the date => :ongoing; all earlier ones ended => :reinstated.
def facilitator_status_as_of(date)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Deliberately computed in-memory (over the already-loaded affiliations) rather than reusing the DB-backed Organization#facilitator_status_on, so classifying a paginated page of ~9 events doesn't fire 2 queries per event. Same classification rule, just no N+1.

title: event.title,
data: { turbo_frame: "_top" },
class: "inline-flex items-center rounded-full text-xs font-medium border px-2.5 py-0.5 #{OrganizationDecorator.program_status_classes(status)}" do %>
<%= status.to_s.titleize %> · <%= event.abbreviation.presence || event.title.truncate(24) %>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Falls back to a truncated title when abbreviation is blank so existing events still render a sensible chip. Chips are gated behind manage? to keep program status admin-only, matching how it was treated on the old index column.

@maebeale maebeale force-pushed the maebeale/remove-org-status-columns branch from 06ca55a to 7fb2709 Compare July 15, 2026 04:51
Copilot AI review requested due to automatic review settings July 15, 2026 04:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale marked this pull request as ready for review July 15, 2026 04:53
New/Reinstate/Ongoing can only be determined relative to a specific event, so
showing it as a global org attribute was misleading. Per-event program status is
surfaced on the org profile in a separate PR (event abbreviations, #1995).

- Drop the admin-only "Program" column from the org index.
- Drop the now-orphaned Organization.program_statuses_by_id bulk classifier.
- Drop the "Program status" block from the org edit form's Affiliations section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 05:06
@maebeale maebeale force-pushed the maebeale/remove-org-status-columns branch from 7fb2709 to c1bb63c Compare July 15, 2026 05:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale changed the title Move org program status out of org-wide UI into event context Remove program status from org-wide UI Jul 15, 2026
Affiliated-since was already affiliation-derived, but showed a single
Mon YYYY – Mon YYYY range. Admins need the real shape of an org's history —
including gaps — and a status vocabulary that isn't event-specific.

- AffiliationPeriods service merges affiliation intervals into periods and
  formats them as year-based ranges: a lone ongoing period shows "Mon YYYY"
  (this year) or its start year; multi-period lists are year-only, e.g.
  "2010-2012, 2026". Falls back to the org's start_date, then blank.
- Applied on the org show page, index column, and edit form; the edit form's
  live preview (affiliation_dates_controller.js) mirrors the same formatting.
- Simplify OrganizationStatus to Active / Formerly active / Unknown. Data
  migration remaps existing statuses (Reinstate->Active, Inactive/Suspended->
  Formerly active, Pending->Unknown) then drops the retired records; the
  affiliation status-sync callback and seeds follow the new names.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale changed the title Remove program status from org-wide UI Rework org status: remove program status, merged affiliated-since, 3-value status Jul 15, 2026
class SimplifyOrganizationStatuses < ActiveRecord::Migration[8.1]
# Retiring the six-value status set down to Active / Formerly active / Unknown.
# Each retired status folds into one of the survivors; Reinstate counts as Active.
RETIRED_TO_REPLACEMENT = {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: The load-bearing decisions to eyeball: Reinstate folds into Active (per request), Inactive/Suspended into Formerly active, Pending into Unknown. down recreates the retired records but cannot restore per-org mappings — a merge is inherently lossy.


// Merge affiliation intervals into periods and format them as year-based ranges
// — the client-side mirror of app/services/affiliation_periods.rb.
affiliatedSinceLabel(affiliations, today) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: This is a hand-kept mirror of AffiliationPeriods (app/services/affiliation_periods.rb) so the edit-form live preview matches the server render. If the Ruby formatting rules change, change both.

…rm's range

The affiliation-dates Stimulus controller is shared with the person edit form,
whose "Affiliated since" stays a single Mon YYYY range. Gate the merged-periods
formatting behind a `periods` value the org form sets, so only the org form's
live preview and server render use periods.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 19:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants