@@ -148,7 +148,7 @@ class MissionsController < ApplicationController |
||
148 | 148 |
submission.date_validated = Time.now |
149 | 149 |
submission.save |
150 | 150 |
submission.agent_step.update(completed: true) |
151 |
- Resque.enqueue(SendStepValidationNotification, submission.agent_step.id) |
|
151 |
+ Resque.enqueue(SendStepNotification, submission.agent_step.id, 'validated') |
|
152 | 152 |
#MissionMailer.step_validation_notification(submission.agent_step).deliver |
153 | 153 |
mission.check_for_completion |
154 | 154 |
redirect_to mission_control_path(mission) |
@@ -165,6 +165,7 @@ class MissionsController < ApplicationController |
||
165 | 165 |
submission.validated_by = current_user |
166 | 166 |
submission.date_validated = Time.now |
167 | 167 |
submission.save |
168 |
+ Resque.enqueue(SendStepNotification, submission.agent_step.id, 'denied') |
|
168 | 169 |
redirect_to mission_control_path(mission) |
169 | 170 |
end |
170 | 171 |
end |
@@ -0,0 +1,16 @@ |
||
1 |
+class SendStepNotification |
|
2 |
+ @queue = :step_notifications |
|
3 |
+ |
|
4 |
+ def self.perform(step_id, notification_type) |
|
5 |
+ step = AgentStep.find(step_id) |
|
6 |
+ case notification_type |
|
7 |
+ when 'validated' |
|
8 |
+ # Send Step Validation Notification Email |
|
9 |
+ MissionMailer.step_validation_notification(step).deliver |
|
10 |
+ when 'denied' |
|
11 |
+ # Send Step Denied Notification Email |
|
12 |
+ MissionMailer.step_denied_notification(step).deliver |
|
13 |
+ end |
|
14 |
+ end |
|
15 |
+ |
|
16 |
+end |
@@ -1,11 +0,0 @@ |
||
1 |
-class SendStepValidationNotification |
|
2 |
- @queue = :step_notifications |
|
3 |
- |
|
4 |
- def self.perform(step_id) |
|
5 |
- # Get step |
|
6 |
- step = AgentStep.find(step_id) |
|
7 |
- # Send Step Validation Notification Email |
|
8 |
- MissionMailer.step_validation_notification(step).deliver |
|
9 |
- end |
|
10 |
- |
|
11 |
-end |