Skip to content

Commit

Permalink
revert the change to lter_affilations
Browse files Browse the repository at this point in the history
  • Loading branch information
kf8a committed Aug 12, 2024
1 parent ec281f6 commit 1a05fd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Represents a person in the system
class Person < ApplicationRecord
has_many :affiliations, dependent: :destroy
has_many :lter_affiliations, -> { where(['role_type_id = ?', RoleType.find_by(name: 'lter')]) },
has_many :lter_roles, -> { where(['role_type_id = ?', RoleType.find_by(name: 'lter')]) },
source: :role, through: :affiliations
has_many :lno_roles, -> { where(['role_type_id = ?', RoleType.find_by(name: 'lno')]) },
source: :role, through: :affiliations
Expand All @@ -20,13 +20,13 @@ class Person < ApplicationRecord
has_many :datatables, through: :data_contributions

accepts_nested_attributes_for :affiliations, allow_destroy: true
accepts_nested_attributes_for :lter_affiliations, allow_destroy: true
accepts_nested_attributes_for :lter_roles, allow_destroy: true

scope :by_sur_name, -> { order 'sur_name' }
scope :by_sur_name_asc, -> { order 'sur_name ASC' }

def only_emeritus?
lter_affiliations.all?(&:emeritus?)
lter_roles.all?(&:emeritus?)
end

def no_current_lno_role?
Expand Down
4 changes: 2 additions & 2 deletions app/views/people/_emeritus.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul>
<li class='person-name'><%= person.given_name %> <%= person.middle_name %> <%= person.sur_name %></li>
<% if person.lter_affiliations.present? -%>
<li class='person_title'><%= person.lter_affiliations[0].name.singularize %></li>
<% if person.lter_roles.present? -%>
<li class='person_title'><%= person.lter_roles[0].name.singularize %></li>
<% end -%>
<% if person.email.present? -%>
<li class='person-email'><%= contact_link(person.email) %></li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/people/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<div class='row clear'>
<table id='affiliations'>
<%= f.semantic_fields_for :lter_affilications do |builder| %>
<%= f.semantic_fields_for :affiliations do |builder| %>
<%= render 'affiliation_fields', f: builder %>
<% end%>
</table>
Expand Down

0 comments on commit 1a05fd9

Please sign in to comment.