-
Notifications
You must be signed in to change notification settings - Fork 24
Show the primary service area consistently with a starred chip #1698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6af76b0
Mark recipients' primary service area with a star and darker chip
maebeale 755e3bd
Show primary sector as a starred chip on person profile and search
maebeale 44949ce
Show only the primary sector on the people index
maebeale 1b24054
Show staff cards' primary sector first with the starred chip
maebeale 67cf16b
Fix profile-flag spec for the renamed Sectors heading
maebeale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -674,6 +674,15 @@ | |
| end | ||
| # Service area chart reads SectorableItem tags, mirroring assign_tags. | ||
| sectors.each { |sector| SectorableItem.find_or_create_by!(sector: sector, sectorable: person) } | ||
| # Make the first submitted service area the person's single primary sector, so the | ||
| # recipients page + profile crown a primary that matches what they selected on the | ||
| # registration form. Demote any other primary first to keep exactly one (a person | ||
| # registered for several events is enriched once per event). Idempotent. | ||
| primary_sector = sectors.first | ||
| if primary_sector | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 From Claude: Demoting any other primary before setting this one keeps exactly one primary even when a person is enriched once per event they registered for — otherwise a multi-event registrant could end up with two starred sectors. |
||
| person.sectorable_items.where(is_primary: true).where.not(sector: primary_sector).update_all(is_primary: false) | ||
| person.sectorable_items.find_by(sector: primary_sector)&.update!(is_primary: true) | ||
| end | ||
| end | ||
|
|
||
| # Give the flagship cohort registration submissions so its Background charts have | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 From Claude:
is_primarydefaults to false, so the ~10 existing callers of this partial render unchanged; only the recipients page opts in.