diff --git a/app/models/user.rb b/app/models/user.rb index fa26ba55..8192acbf 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -24,7 +24,7 @@ def logged_in? def self.all_with_chapter(chapter_id) association = joins("LEFT JOIN roles ON users.id = roles.user_id"). joins("LEFT JOIN chapters ON chapters.id = roles.chapter_id"). - select("users.*, chapters.name AS chapter_name, roles.id AS role_id, roles.name AS role_name"). + select("users.*, chapters.name AS chapter_name, chapters.inactive_at AS chapter_inactive_at, roles.id AS role_id, roles.name AS role_name"). order(:first_name, :id) if chapter_id.nil? association diff --git a/app/views/users/index.csv.erb b/app/views/users/index.csv.erb index 810d8042..81d4a44c 100644 --- a/app/views/users/index.csv.erb +++ b/app/views/users/index.csv.erb @@ -1,4 +1,4 @@ -<%= CSV.generate_line %w[id first_name last_name email url chapter_name role created_at updated_at] -%> +<%= CSV.generate_line %w[id first_name last_name email url chapter_name role created_at updated_at chapter_active] -%> <%- @users.each do |user| -%> - <%= CSV.generate_line([user.id, user.first_name, user.last_name, user.email, user.url, user.chapter_name, user.role_name, user.created_at.to_s(:iso8601), user.updated_at.to_s(:iso8601)]).html_safe -%> + <%= CSV.generate_line([user.id, user.first_name, user.last_name, user.email, user.url, user.chapter_name, user.role_name, user.created_at.to_s(:iso8601), user.updated_at.to_s(:iso8601), (user.chapter_name.blank? ? nil : user.chapter_inactive_at.blank?)]).html_safe -%> <%- end -%>