Skip to content

Commit

Permalink
Merge pull request #546 from awesomefoundation/add-chapter-active-boo…
Browse files Browse the repository at this point in the history
…lean-users-csv

Add chapter_active to users.csv download
  • Loading branch information
jcn authored Jun 16, 2024
2 parents 1db25f6 + 3b50cd7 commit f0df35d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/views/users/index.csv.erb
Original file line number Diff line number Diff line change
@@ -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 -%>

0 comments on commit f0df35d

Please sign in to comment.