Skip to content

Default new affiliations to first of month and unchecked primary contact#1922

Merged
maebeale merged 1 commit into
mainfrom
maebeale/affiliation-defaults
Jun 26, 2026
Merged

Default new affiliations to first of month and unchecked primary contact#1922
maebeale merged 1 commit into
mainfrom
maebeale/affiliation-defaults

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 PR, suggested 👤 review level: 👀 Skim — view-only: form default changes in a shared partial, no logic or data changes

What & why

New affiliation rows in the people-edit and org-edit forms now default to:

  • Start date = first of the current month (was today). Affiliations are tracked from the start of the month.
  • Primary org contact = unchecked (was pre-checked). Most people on an org aren't its primary contact; the pre-check made admins accept a usually-wrong default.

Both are view-only changes in the shared partial app/views/affiliations/_fields.html.erb. Existing affiliations still render their stored values; the DB default for primary_contact was already false.

Tests

  • View spec asserting a newly-built affiliation renders the first-of-month start date and an unchecked primary-contact box.

Pre-filling today's date and a checked primary-contact box made admins
accept defaults that were usually wrong: affiliations are tracked from
the start of the month, and most people on an org are not its primary
contact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
input_html: {
type: "date",
value: (f.object.start_date || (Date.current unless f.object.persisted?))&.strftime("%Y-%m-%d"),
value: (f.object.start_date || (Date.current.beginning_of_month unless f.object.persisted?))&.strftime("%Y-%m-%d"),

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: Both defaults only apply to unpersisted rows (unless f.object.persisted? for the date; primary_contact? reflects the stored value for existing rows), so editing an existing affiliation is unaffected.

@maebeale maebeale marked this pull request as ready for review June 26, 2026 03:08
@maebeale maebeale merged commit ed1e9ff into main Jun 26, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/affiliation-defaults branch June 26, 2026 03:09
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.

1 participant