Skip to content

Commit

Permalink
Updating communities based on feedback (#1973)
Browse files Browse the repository at this point in the history
fixes #1970
  • Loading branch information
carolyncole authored Oct 22, 2024
1 parent 5327f4e commit 6694eb2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ def communities
if code == "PPPL"
["Princeton Plasma Physics Laboratory"]
else
["Princeton Neuroscience Institute", "Department of Geosciences", "Mechanical and Aerospace Engineering",
["Princeton Neuroscience Institute", "Geosciences", "Mechanical and Aerospace Engineering",
"Astrophysical Sciences", "Civil and Environmental Engineering", "Chemical and Biological Engineering",
"Digital Humanities", "Music and Arts", "Princeton School of Public and International Affairs"].sort
"Digital Humanities", "Music and Arts", "Princeton School of Public and International Affairs",
"Chemistry", "Lewis Seigler Genomics", "Architecture", "Ecology and Evolutionary Biology", "Economics"].sort
end
end

Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20241021194327_deparment_community.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class DeparmentCommunity < ActiveRecord::Migration[7.2]
def change
Work.where("metadata @> ?", JSON.dump(communities: ["Department of Geosciences"])).each do |work|
communities = work.resource.communities
work.resource.communities = communities.map {|community| community == "Department of Geosciences" ? "Geosciences" : community }
work.save
end
end
end
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/models/group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
it "sorts alphabetically communities and subcommunities" do
described_class.create_defaults
group_rd = described_class.where(code: "RD").first
expect(group_rd.communities.first).to eq "Astrophysical Sciences"
expect(group_rd.communities.first).to eq "Architecture"
expect(group_rd.communities.last).to eq "Princeton School of Public and International Affairs"

group_pppl = described_class.where(code: "PPPL").first
Expand Down
4 changes: 2 additions & 2 deletions spec/system/work_edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@
sign_in user
visit edit_work_path(work)
click_on "Additional Metadata"
select "Department of Geosciences", from: "communities"
select "Geosciences", from: "communities"
expect(page).to_not have_content("Subcommunities")
click_on "Save Work"
expect(page).to have_content("Department of Geosciences")
expect(page).to have_content("Geosciences")
end
end

Expand Down

0 comments on commit 6694eb2

Please sign in to comment.