From 2063ffa6b897a322456ca3e53e887d6fb1921b5c Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 1 Mar 2024 07:00:55 -0600 Subject: [PATCH] Fix the help for the User Detail page. It still references the check boxes for the date overrides which no longer exist. Also translate the error messages from when the dates are checked. --- .../ContentGenerator/Instructor/UserDetail.pm | 27 +++++++++++-------- .../UserDetail/set_date_table.html.ep | 7 ++--- .../Instructor/UserDetail/set_row.html.ep | 1 - .../HelpFiles/InstructorUserDetail.html.ep | 11 ++++---- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm b/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm index dedfc7a163..3ecf0a9a19 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm @@ -187,32 +187,37 @@ sub checkDates ($c, $setRecord, $setID) { my ($open_date, $reduced_scoring_date, $due_date, $answer_date) = map { $dates{$_} } @{ DATE_FIELDS_ORDER() }; unless ($answer_date && $due_date && $open_date) { - $c->addbadmessage("Set $setID has errors in its dates: " - . "open_date |$open_date|, due date |$due_date|, answer_date |$answer_date|"); + $c->addbadmessage($c->maketext( + 'Set [_1] has errors in its dates: open_date |[_2]|, due date |[_3]|, answer_date |[_4]|', + $setID, $open_date, $due_date, $answer_date + )); return { %dates, error => 1 }; } my $error = 0; - if ($answer_date < $due_date || $answer_date < $open_date) { - $c->addbadmessage("Answers cannot be made available until on or after the due date in set $setID!"); + if ($c->ce->{pg}{ansEvalDefaults}{enableReducedScoring} + && $setRecord->enable_reduced_scoring + && ($reduced_scoring_date < $open_date || $reduced_scoring_date > $due_date)) + { + $c->addbadmessage($c->maketext( + 'The reduced scoring date must be between the open date and the due date for set [_1].', $setID + )); $error = 1; } if ($due_date < $open_date) { - $c->addbadmessage("Answers cannot be due until on or after the open date in set $setID!"); + $c->addbadmessage($c->maketext('The due date must be on or after the open date for set [_1].', $setID)); $error = 1; } - if ($c->ce->{pg}{ansEvalDefaults}{enableReducedScoring} - && $setRecord->enable_reduced_scoring - && ($reduced_scoring_date < $open_date || $reduced_scoring_date > $due_date)) - { - $c->addbadmessage("The reduced scoring date should be between the open date and the due date in set $setID!"); + if ($answer_date < $due_date) { + $c->addbadmessage( + $c->maketext('Answers cannot be made available until on or after the due date for set [_1].', $setID)); $error = 1; } - $c->addbadmessage('No date changes were saved!') if $error; + $c->addbadmessage($c->maketext('Not saving dates for [_1]!', $setID)) if $error; return { %dates, error => $error }; } diff --git a/templates/ContentGenerator/Instructor/UserDetail/set_date_table.html.ep b/templates/ContentGenerator/Instructor/UserDetail/set_date_table.html.ep index 25bd7d166d..01a2496e96 100644 --- a/templates/ContentGenerator/Instructor/UserDetail/set_date_table.html.ep +++ b/templates/ContentGenerator/Instructor/UserDetail/set_date_table.html.ep @@ -34,8 +34,6 @@ % && (!$ce->{pg}{ansEvalDefaults}{enableReducedScoring} || !$globalRecord->enable_reduced_scoring); % - % my $globalValue = $globalRecord->$field; - % <%= label_for "set.$setID.$field" . (defined $userRecord ? '_id' : '.class_value') => maketext($fieldLabels->{$field}), @@ -44,7 +42,7 @@ % unless ($isVersioned) { <%= text_field "set.$setID.$field.class_value" => - $c->formatDateTime($globalValue, 'datetime_format_short'), + $c->formatDateTime($globalRecord->$field, 'datetime_format_short'), id => "set.$setID.$field.class_value", readonly => undef, dir => 'ltr', class => 'form-control-plaintext form-control-sm w-auto', size => 16, @@ -54,8 +52,7 @@ % if (defined $userRecord) {
- <%= text_field "set.$setID.$field" => - defined $userRecord ? $userRecord->$field : $globalValue, + <%= text_field "set.$setID.$field" => $userRecord->$field, id => "set.$setID.${field}_id", class => 'form-control w-auto' . ($field eq 'open_date' ? ' datepicker-group' : ''), placeholder => $isGateway diff --git a/templates/ContentGenerator/Instructor/UserDetail/set_row.html.ep b/templates/ContentGenerator/Instructor/UserDetail/set_row.html.ep index 33d26d9397..3e090476b7 100644 --- a/templates/ContentGenerator/Instructor/UserDetail/set_row.html.ep +++ b/templates/ContentGenerator/Instructor/UserDetail/set_row.html.ep @@ -1,6 +1,5 @@ % use WeBWorK::Utils qw(format_set_name_display); % -% # my ($set, $userSet, $mergedSet, $version) = @_; % my $setID = $set->set_id; % my $isGateway = $set->assignment_type =~ /gateway/; % my $version = stash 'version'; diff --git a/templates/HelpFiles/InstructorUserDetail.html.ep b/templates/HelpFiles/InstructorUserDetail.html.ep index d7e2dc5ab3..a3fd81b91c 100644 --- a/templates/HelpFiles/InstructorUserDetail.html.ep +++ b/templates/HelpFiles/InstructorUserDetail.html.ep @@ -23,11 +23,12 @@ . 'is deleted and cannot be recovered. Use this action cautiously!') =%>

- <%= maketext('Change the due dates for an individual student on this page. Check the checkbox and enter the new ' - . 'date in order to override the date. (You can copy the date format from the date in the right hand column ' - . 'which indicates the date when the homework set is due for the whole class.) Note that you should ensure ' - . 'that the close date is before the answer date. If the close date for a student is extended until after the ' - . 'class answer date for the set, then the answer date for the student must also be set to a later date. ' + <%= maketext('Change the due dates for an individual student on this page. Enter a new date in order to ' + . 'override the date. (You can copy the date format from the date in the left column which indicates ' + . 'the date when the homework set is due for the whole class.) Note that you should ensure that the close ' + . 'date is before the answer date. If the close date for a student is extended until after the class answer ' + . 'date for the set, then the answer date for the student must also be set to a later date. If reduced ' + . 'scoring is enabled for the set, then the reduced scoring date must be between the open and close dates. ' . 'If a date is left empty, then the assignment default date will be used.') =%>