diff --git a/app/controllers/learning_hours_controller.rb b/app/controllers/learning_hours_controller.rb index 4aeb26bff7..eb2eec77c6 100644 --- a/app/controllers/learning_hours_controller.rb +++ b/app/controllers/learning_hours_controller.rb @@ -22,7 +22,7 @@ def create respond_to do |format| if @learning_hour.save format.html { redirect_to volunteer_learning_hours_path(volunteer_id: current_user.id), notice: "New entry was successfully created." } - LearningHoursMailer.with(user: @user, casa_org: @casa_org).learning_hours_report_email.deliver_later + LearningHoursMailer.with(user: @user, casa_org: @casa_org, csv_data: csv_data).learning_hours_report_email.deliver_later else format.html { render :new, status: 404 } end diff --git a/app/mailers/learning_hours_mailer.rb b/app/mailers/learning_hours_mailer.rb index cc3fe3d011..0e0e1d9159 100644 --- a/app/mailers/learning_hours_mailer.rb +++ b/app/mailers/learning_hours_mailer.rb @@ -1,8 +1,8 @@ class LearningHoursMailer < ApplicationMailer - def learning_hours_report_email(user) + def learning_hours_report_email(user, casa_org, csv_data) @user = user - @casa_org = user.casa_org - #attachments["learning_hours_report.csv"] = attachment + @casa_org = casa_org + attachments['learning_hours_report.csv'] = csv_data mail(to: @user.email, subject: "Learning Hours Report - #{last_day_of_month.strftime('%Y-%m-%d')}") end diff --git a/app/views/learning_hours_mailer/learning_hours_report_email.html.erb b/app/views/learning_hours_mailer/learning_hours_report_email.html.erb index 1d96d547ac..59a4defd0c 100644 --- a/app/views/learning_hours_mailer/learning_hours_report_email.html.erb +++ b/app/views/learning_hours_mailer/learning_hours_report_email.html.erb @@ -6,91 +6,75 @@
-
|