diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 73367d10..497c2a31 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -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
diff --git a/app/views/user_mailer/exercise_anomaly_needs_feedback.html.slim b/app/views/user_mailer/exercise_anomaly_needs_feedback.html.slim
new file mode 100644
index 00000000..336f3c29
--- /dev/null
+++ b/app/views/user_mailer/exercise_anomaly_needs_feedback.html.slim
@@ -0,0 +1 @@
+== t('mailers.user_mailer.exercise_anomaly_needs_feedback.body', receiver_displayname: @receiver_displayname, exercise: @exercise_title, link: link_to(@link, @link))
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 1e7d1d00..ff353b9a 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -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.
This mail was automatically sent by CodeOcean.
+ exercise_anomaly_needs_feedback:
+ body: |
+ English version below
+ _________________________
+
+ Hallo %{receiver_displayname},
+
+ 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:
+
+ %{exercise} - %{link}
+
+ 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.
+
+ Diese Mail wurde automatisch von CodeOcean verschickt.
+
+ _________________________
+
+ Dear %{receiver_displayname},
+
+ 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:
+
+ %{exercise} - %{link}
+
+ 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.
+
+ This mail was automatically sent by CodeOcean.
+ subject: "Eine Aufgabe auf CodeOcean benötigt Ihr Feedback"
request_for_comments:
click_here: Zum Kommentieren auf die Seitenleiste klicken!
comments: Kommentare
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d5e8cd4d..7d475c88 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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.
This mail was automatically sent by CodeOcean.
+ exercise_anomaly_needs_feedback:
+ body: |
+ English version below
+ _________________________
+
+ Hallo %{receiver_displayname},
+
+ 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:
+
+ %{exercise} - %{link}
+
+ 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.
+
+ Diese Mail wurde automatisch von CodeOcean verschickt.
+
+ _________________________
+
+ Dear %{receiver_displayname},
+
+ 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:
+
+ %{exercise} - %{link}
+
+ 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.
+
+ This mail was automatically sent by CodeOcean.
+ subject: "An exercise on CodeOcean needs your feedback"
request_for_comments:
click_here: Click on this sidebar to comment!
comments: Comments
diff --git a/lib/tasks/detect_exercise_anomalies.rake b/lib/tasks/detect_exercise_anomalies.rake
index e271387c..0a9b9b7e 100644
--- a/lib/tasks/detect_exercise_anomalies.rake
+++ b/lib/tasks/detect_exercise_anomalies.rake
@@ -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