refactor(manager data exports): renaming methods

This commit is contained in:
Eric Leroy-Terquem 2024-11-04 17:40:45 +01:00
parent 4f0713a764
commit 7cf81d3e9b
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
4 changed files with 6 additions and 6 deletions

View file

@ -40,7 +40,7 @@ module Manager
def data_exports def data_exports
end end
def export_last_month def export_last_half_year
administrateurs = Administrateur.joins(:user).where(created_at: 6.months.ago..).where.not(users: { email_verified_at: nil }) administrateurs = Administrateur.joins(:user).where(created_at: 6.months.ago..).where.not(users: { email_verified_at: nil })
csv = CSV.generate(headers: true) do |csv| csv = CSV.generate(headers: true) do |csv|
csv << ['ID', 'Email', 'Date de création'] csv << ['ID', 'Email', 'Date de création']

View file

@ -23,7 +23,7 @@ module Manager
redirect_to manager_instructeurs_path redirect_to manager_instructeurs_path
end end
def export_last_month def export_last_half_year
instructeurs = Instructeur.joins(:user).where(created_at: 6.months.ago..).where.not(users: { email_verified_at: nil }) instructeurs = Instructeur.joins(:user).where(created_at: 6.months.ago..).where.not(users: { email_verified_at: nil })
csv = CSV.generate(headers: true) do |csv| csv = CSV.generate(headers: true) do |csv|
csv << ['ID', 'Email', 'Date de création'] csv << ['ID', 'Email', 'Date de création']

View file

@ -1,6 +1,6 @@
<div> <div>
<ul> <ul>
<li><a href="/manager/exports/administrateurs/last_month">Export des administrateurs (6 mois)</a></li> <li><a href="/manager/exports/administrateurs/last_half_year">Export des administrateurs créés dans les 6 derniers mois</a></li>
<li><a href="/manager/exports/instructeurs/last_month">Export des instructeurs (6 mois)</a></li> <li><a href="/manager/exports/instructeurs/last_half_year">Export des instructeurs créés dans les 6 derniers mois</a></li>
</ul> </ul>
</div> </div>

View file

@ -115,8 +115,8 @@ Rails.application.routes.draw do
end end
get 'data_exports' => 'administrateurs#data_exports' get 'data_exports' => 'administrateurs#data_exports'
get 'exports/administrateurs/last_month' => 'administrateurs#export_last_month' get 'exports/administrateurs/last_half_year' => 'administrateurs#export_last_half_year'
get 'exports/instructeurs/last_month' => 'instructeurs#export_last_month' get 'exports/instructeurs/last_half_year' => 'instructeurs#export_last_half_year'
get 'import_procedure_tags' => 'procedures#import_data' get 'import_procedure_tags' => 'procedures#import_data'
post 'import_tags' => 'procedures#import_tags' post 'import_tags' => 'procedures#import_tags'