Skip to content

Commit

Permalink
Fix the help for the User Detail page.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
drgrice1 committed Mar 3, 2024
1 parent f70b0c9 commit 5200f0c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
30 changes: 19 additions & 11 deletions lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm
Original file line number Diff line number Diff line change
Expand Up @@ -187,32 +187,40 @@ 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] , Close Date: [_3], Answer Date: [_4]',
$setID,
map { $_ ? $c->formatDateTime($_, 'datetime_format_short') : $c->maketext('required') }
($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 close 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 close 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 close 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 };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
% && (!$ce->{pg}{ansEvalDefaults}{enableReducedScoring} || !$globalRecord->enable_reduced_scoring);
%
<tr>
% my $globalValue = $globalRecord->$field;
%
<td class="px-1 text-nowrap">
<%= label_for "set.$setID.$field" . (defined $userRecord ? '_id' : '.class_value') =>
maketext($fieldLabels->{$field}),
Expand All @@ -44,7 +42,7 @@
% unless ($isVersioned) {
<td class="px-1 text-nowrap">
<%= 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,
Expand All @@ -54,8 +52,7 @@
% if (defined $userRecord) {
<td class="px-1 text-nowrap">
<div class="input-group input-group-sm flex-nowrap flatpickr">
<%= 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
11 changes: 6 additions & 5 deletions templates/HelpFiles/InstructorUserDetail.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
. 'is deleted and cannot be recovered. Use this action cautiously!') =%>
</p>
<p>
<%= 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.') =%>
</p>
<p class="mb-0">
Expand Down

0 comments on commit 5200f0c

Please sign in to comment.