Send emails
This commit is contained in:
@ -44,4 +44,11 @@ class UserMailer < ActionMailer::Base
|
||||
@anomalies = anomalies
|
||||
mail(subject: t('mailers.user_mailer.exercise_anomaly_detected.subject'), to: exercise_collection.user.email)
|
||||
end
|
||||
|
||||
def exercise_anomaly_needs_feedback(user, exercise, link)
|
||||
@receiver_displayname = user.displayname
|
||||
@exercise_title = exercise.title
|
||||
@link = link
|
||||
mail(subject: t('mailers.user_mailer.exercise_anomaly_needs_feedback.subject'), to: user.email)
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1 @@
|
||||
== t('mailers.user_mailer.exercise_anomaly_needs_feedback.body', receiver_displayname: @receiver_displayname, exercise: @exercise_title, link: link_to(@link, @link))
|
@ -551,6 +551,33 @@ de:
|
||||
If you receive an error that you are not authorized to perform this action when clicking a link, please log-in through any course exercise beforehand and click the link again. <br>
|
||||
<br>
|
||||
This mail was automatically sent by CodeOcean. <br>
|
||||
exercise_anomaly_needs_feedback:
|
||||
body: |
|
||||
English version below <br>
|
||||
_________________________<br>
|
||||
<br>
|
||||
Hallo %{receiver_displayname}, <br>
|
||||
<br>
|
||||
um die Aufgaben auf CodeOcean weiter zu verbessern, benötigen wir Ihre Mithilfe. Bitte nehmen Sie sich ein paar Minuten Zeit um ein kurzes Feedback zu folgender Aufgabe zu geben:
|
||||
<br>
|
||||
%{exercise} - %{link}
|
||||
<br>
|
||||
Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.<br>
|
||||
<br>
|
||||
Diese Mail wurde automatisch von CodeOcean verschickt.<br>
|
||||
<br>
|
||||
_________________________<br>
|
||||
<br>
|
||||
Dear %{receiver_displayname}, <br>
|
||||
<br>
|
||||
we need your help to improve the quality of the exercises on CodeOcean. Please take a few minutes to give us feedback for the following exercise:
|
||||
<br>
|
||||
%{exercise} - %{link}
|
||||
<br>
|
||||
If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again. <br>
|
||||
<br>
|
||||
This mail was automatically sent by CodeOcean. <br>
|
||||
subject: "Eine Aufgabe auf CodeOcean benötigt Ihr Feedback"
|
||||
request_for_comments:
|
||||
click_here: Zum Kommentieren auf die Seitenleiste klicken!
|
||||
comments: Kommentare
|
||||
|
@ -551,6 +551,33 @@ en:
|
||||
If you receive an error that you are not authorized to perform this action when clicking a link, please log-in through any course exercise beforehand and click the link again. <br>
|
||||
<br>
|
||||
This mail was automatically sent by CodeOcean. <br>
|
||||
exercise_anomaly_needs_feedback:
|
||||
body: |
|
||||
English version below <br>
|
||||
_________________________<br>
|
||||
<br>
|
||||
Hallo %{receiver_displayname}, <br>
|
||||
<br>
|
||||
um die Aufgaben auf CodeOcean weiter zu verbessern, benötigen wir Ihre Mithilfe. Bitte nehmen Sie sich ein paar Minuten Zeit um ein kurzes Feedback zu folgender Aufgabe zu geben:
|
||||
<br>
|
||||
%{exercise} - %{link}
|
||||
<br>
|
||||
Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.<br>
|
||||
<br>
|
||||
Diese Mail wurde automatisch von CodeOcean verschickt.<br>
|
||||
<br>
|
||||
_________________________<br>
|
||||
<br>
|
||||
Dear %{receiver_displayname}, <br>
|
||||
<br>
|
||||
we need your help to improve the quality of the exercises on CodeOcean. Please take a few minutes to give us feedback for the following exercise:
|
||||
<br>
|
||||
%{exercise} - %{link}
|
||||
<br>
|
||||
If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again. <br>
|
||||
<br>
|
||||
This mail was automatically sent by CodeOcean. <br>
|
||||
subject: "An exercise on CodeOcean needs your feedback"
|
||||
request_for_comments:
|
||||
click_here: Click on this sidebar to comment!
|
||||
comments: Comments
|
||||
|
@ -121,8 +121,12 @@ namespace :detect_exercise_anomalies do
|
||||
end
|
||||
|
||||
users_to_notify.uniq! &by_id_and_type
|
||||
users_to_notify.each do |u|
|
||||
user = u[:user_type] == InternalUser.name ? InternalUser.find(u[:user_id]) : ExternalUser.find(u[:user_id])
|
||||
feedback_link = 'http://google.com'
|
||||
UserMailer.exercise_anomaly_needs_feedback(user, exercise, feedback_link).deliver
|
||||
end
|
||||
puts "\t\tAsked #{users_to_notify.size} users for feedback."
|
||||
# todo: send emails
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user