-
Notifications
You must be signed in to change notification settings - Fork 24
Add sector descriptions and refresh the canonical sector list #1703
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
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
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| class AddDescriptionToSectors < ActiveRecord::Migration[8.1] | ||
| def up | ||
| add_column :sectors, :description, :text unless column_exists?(:sectors, :description) | ||
| end | ||
|
|
||
| def down | ||
| remove_column :sectors, :description, :text, if_exists: true | ||
| end | ||
| end |
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 |
|---|---|---|
|
|
@@ -149,11 +149,35 @@ def find_or_create_by_name!(klass, name, **attrs, &block) | |
| end | ||
|
|
||
| puts "Creating Sectors…" | ||
| # Optional descriptions clarify a sector on the public registration form: shown as | ||
| # subtext under the checkbox in the additional service-areas list, and folded into | ||
| # the "Name (description)" label in the single primary service-area dropdown (which | ||
| # can't show subtext). They come from the parenthetical clarifications on the | ||
| # canonical sector list. Names without an entry below have no description. Admins | ||
| # can edit each from the Sectors admin once seeded. | ||
| sector_descriptions = { | ||
| "Climate/Environmental" => "fire recovery, disaster response, environmental trauma", | ||
| "Community Violence" => "gang violence, police violence, mass shootings, etc.", | ||
| "Health/Medical" => "hospitals, first responders, illness and chronic disease", | ||
| "Immigration" => "family separation, deportation, refugees/asylees, etc.", | ||
| "Incarceration" => "including re-entry services", | ||
| "Reproductive Services" => "birth trauma, perinatal care, challenges conceiving, etc.", | ||
| "Restorative/Transformative Justice" => "individual and community reconciliation", | ||
| "Staff/Organizational Development" => "Secondary/Vicarious Trauma", | ||
| "Systems/Policy Change" => "Advocating at state/government levels for policy change" | ||
| } | ||
| Sector::SECTOR_TYPES.each do |sector_type| | ||
| sector = find_or_create_by_name!(Sector, sector_type) | ||
| sector.update!(published: true) unless sector.published? | ||
| sector.update!(published: true, description: sector_descriptions[sector_type]) | ||
| end | ||
|
|
||
| # Unpublish any sector no longer on the canonical list, preserving its historical | ||
| # taggings rather than destroying them. SECTOR_TYPES already includes the "Other" | ||
| # catch-all, so it stays published. | ||
| canonical_names = Sector::SECTOR_TYPES.map(&:downcase) | ||
| Sector.reject { |sector| canonical_names.include?(sector.name.downcase) } | ||
|
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: Sectors dropped from the canonical list are unpublished here, not destroyed, so historical taggings survive. |
||
| .each { |sector| sector.update!(published: false) } | ||
|
|
||
| puts "Creating CategoryTypes/Categories…" | ||
| category_type_categories = [ | ||
| [ "AgeRange", "3-5" ], | ||
|
|
||
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: A dropdown can't show subtext, so a sector/category description is folded into the label as "Name (description)" here; the checkbox/radio renderers instead show it as gray subtext under the option.