Skip to content
This repository has been archived by the owner on Apr 5, 2020. It is now read-only.

Commit

Permalink
#16 <@callegas, @lucasgaspari> - Adicionar método de envio de email p…
Browse files Browse the repository at this point in the history
…ara usuarios do tipo sanguineo nao sei
  • Loading branch information
lucasgaspari committed Nov 16, 2016
1 parent 005943d commit c35de0a
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 47 deletions.
16 changes: 10 additions & 6 deletions app/controllers/demand_blood_banks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ def create
donator.last_donation_token = SecureRandom.urlsafe_base64.to_s
donator.notification_token = SecureRandom.urlsafe_base64.to_s
donator.save!

response = NotificationMailer.send_email(donator, @bank).deliver_now
Notification.create! :last_notification => Date.current,
:appear => false,
:user_blood_donators_id => donator.id,
:demand_blood_banks_id => @demand_blood_bank.id
if donator.blood_type == ""
NotificationMailer.send_email_no_blood_type_donator(donator).deliver_now
else
response = NotificationMailer.send_email(donator, @bank).deliver_now
Notification.create! :last_notification => Date.current,
:appear => false,
:user_blood_donators_id => donator.id,
:demand_blood_banks_id => @demand_blood_bank.id
end
end
end
format.html { }
Expand Down Expand Up @@ -101,6 +104,7 @@ def make_demand_array demand
array.push("AB-") unless demand.ab_negative.nil?
array.push("O+") unless demand.o_positive.nil?
array.push("O-") unless demand.o_negative.nil?
array.push("")
array
end

Expand Down
9 changes: 8 additions & 1 deletion app/mailers/notification_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def send_notification_to_admin bank
template_path: 'notification_mailer',
template_name: 'new_blood_bank_email')
end

def send_email_no_blood_type_donator user
@user = user
@url = 'http://hemoheroestw-staging.herokuapp.com/admin'
mail(to: @user.email,
subject: 'no type',
template_path: 'notification_mailer',
template_name: 'mailer_no_blood_type.html.erb')
end

end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h2>AUHSUAHsuAHSUAHsuHAUStesteeeee</h2>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= yield %>
2 changes: 1 addition & 1 deletion coverage/.last_run.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"result": {
"covered_percent": 81.29
"covered_percent": 80.7
}
}
88 changes: 49 additions & 39 deletions coverage/.resultset.json
Original file line number Diff line number Diff line change
Expand Up @@ -1078,37 +1078,46 @@
1,
null
],
"/myapp/app/admin/dashboard.rb": [
"/myapp/app/admin/user_blood_donator.rb": [
1,
null,
1,
null,
1,
0,
0,
0,
0,
0,
0,
0,
null,
null,
1,
null,
null,
null
],
"/myapp/app/models/user_blood_donator.rb": [
1,
null,
1,
null,
null,
null,
null,
null,
null,
null,
1,
null,
null,
null,
1,
0,
null,
null,
null,
null,
null,
null,
1,
0,
null,
null,
null
Expand Down Expand Up @@ -1154,9 +1163,9 @@
null,
null
],
"/myapp/app/admin/user_blood_donator.rb": [
"/myapp/app/admin/admin_user.rb": [
1,
1,
null,
null,
1,
0,
Expand All @@ -1169,61 +1178,52 @@
null,
null,
1,
1,
1,
1,
null,
1,
0,
0,
0,
0,
null,
0,
null,
null,
null
],
"/myapp/app/models/user_blood_donator.rb": [
"/myapp/app/admin/dashboard.rb": [
1,
null,
1,
null,
1,
0,
0,
0,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1,
null,
null,
null,
1,
0,
null,
null,
1,
0,
null,
null,
null
],
"/myapp/app/admin/admin_user.rb": [
1,
1,
null,
1,
0,
0,
0,
0,
0,
0,
0,
null,
null,
1,
1,
1,
1,
null,
1,
0,
0,
0,
0,
null,
0,
null,
null,
null
Expand Down Expand Up @@ -1253,7 +1253,6 @@
null,
null,
null,
null,
1,
1,
1,
Expand Down Expand Up @@ -1666,6 +1665,13 @@
null,
null,
null,
1,
0,
0,
0,
null,
null,
null,
null,
null,
null
Expand Down Expand Up @@ -1770,6 +1776,8 @@
0,
0,
0,
0,
0,
null,
0,
0,
Expand All @@ -1778,6 +1786,7 @@
null,
null,
null,
null,
2,
2,
null,
Expand Down Expand Up @@ -1839,6 +1848,7 @@
2,
2,
2,
2,
null,
null,
1,
Expand Down Expand Up @@ -2049,6 +2059,6 @@
null
]
},
"timestamp": 1479302859
"timestamp": 1479303948
}
}

0 comments on commit c35de0a

Please sign in to comment.