Skip to content

Commit ef3863f

Browse files
committed
Add a task name for the AchievementNotification.pm task and other minor cleanup.
1 parent dc9221f commit ef3863f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/Mojolicious/WeBWorK/Tasks/AchievementNotification.pm

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,25 @@ sub run ($job, $mail_data) {
3535
return $job->fail("Could not construct course environment for $mail_data->{courseName}.")
3636
unless $ce;
3737

38-
$job->{language_handle} =
39-
WeBWorK::Localize::getLoc($ce->{language} || 'en');
38+
$job->{language_handle} = WeBWorK::Localize::getLoc($ce->{language} || 'en');
4039

4140
my $db = WeBWorK::DB->new($ce->{dbLayout});
42-
return $job->fail($job->maketext("Could not obtain database connection for [_1].", $mail_data->{courseName}))
41+
return $job->fail($job->maketext('Could not obtain database connection for [_1].', $mail_data->{courseName}))
4342
unless $db;
4443

45-
return $job->fail($job->maketext("Cannot notify student without an achievement."))
44+
return $job->fail($job->maketext('Cannot notify student without an achievement.'))
4645
unless $mail_data->{achievementID};
4746
$mail_data->{achievement} = $db->getAchievement($mail_data->{achievementID});
48-
return $job->fail($job->maketext("Could not find achievement [_1].", $mail_data->{achievementID}))
47+
return $job->fail($job->maketext('Could not find achievement [_1].', $mail_data->{achievementID}))
4948
unless $mail_data->{achievement};
5049

5150
my $result_message = eval { $job->send_achievement_notification($ce, $db, $mail_data) };
5251
if ($@) {
53-
$job->app->log->error($job->maketext("An error occurred while trying to send email: $@"));
54-
return $job->fail($job->maketext("An error occurred while trying to send email: [_1]", $@));
52+
$job->app->log->error("An error occurred while trying to send email: $@");
53+
return $job->fail($job->maketext('An error occurred while trying to send email: [_1]', $@));
5554
}
5655
$job->app->log->info("Message sent to $mail_data->{recipient}");
57-
return $job->finish($job->maketext("Message sent to [_1]", $mail_data->{recipient}));
56+
return $job->finish($result_message);
5857
}
5958

6059
sub send_achievement_notification ($job, $ce, $db, $mail_data) {

lib/WeBWorK/ContentGenerator/Instructor/JobManager.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ use constant ACTION_FORMS => [ [ filter => x('Filter') ], [ sort => x('Sort') ],
2828

2929
# All tasks added in the Mojolicious::WeBWorK module need to be listed here.
3030
use constant TASK_NAMES => {
31-
lti_mass_update => x('LTI Mass Update'),
32-
send_instructor_email => x('Send Instructor Email')
31+
lti_mass_update => x('LTI Mass Update'),
32+
send_instructor_email => x('Send Instructor Email'),
33+
send_achievement_email => x('Send Achiement Email')
3334
};
3435

3536
# This constant is not used. It is here so that gettext adds these strings to the translation files.

0 commit comments

Comments
 (0)