From: Mike G. v. a. <we...@ma...> - 2010-01-11 18:48:05
|
Log Message: ----------- Fix to prevent the error messages that occur when the problem set has not yet been assigned to a user. Still a bit fragile and under tested but it at least stops the error messages from being issued. Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator/Instructor: ProblemSetDetail.pm ProblemSetList.pm Revision Data ------------- Index: ProblemSetDetail.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm,v retrieving revision 1.77 retrieving revision 1.78 diff -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm -u -r1.77 -r1.78 --- lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm +++ lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm @@ -485,7 +485,8 @@ if ($field =~ /_date/) { $globalValue = $self->formatDateTime($globalValue) if defined $globalValue && $globalValue ne $labels{""}; - $userValue = $self->formatDateTime($userValue) if defined $userValue && $userValue ne $labels{""}; + # this is still fragile, but the check for blank (as opposed to 0) $userValue seems to prevent errors when no user has been assigned. + $userValue = $self->formatDateTime($userValue) if defined $userValue && $userValue =~/\S/ && $userValue ne $labels{""}; } if ( defined($properties{convertby}) && $properties{convertby} ) { Index: ProblemSetList.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm,v retrieving revision 1.109 retrieving revision 1.110 diff -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm -u -r1.109 -r1.110 --- lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm +++ lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm @@ -1096,11 +1096,11 @@ $newSetRecord->set_id($newSetID); $newSetRecord->set_header(""); $newSetRecord->hardcopy_header(""); - $newSetRecord->open_date(time + ONE_WEEK); - $newSetRecord->due_date(time + 2*ONE_WEEK ); - $newSetRecord->answer_date(time + 2*ONE_WEEK ); - $newSetRecord->published(DEFAULT_PUBLISHED_STATE); # don't want students to see an empty set - $newSetRecord->enable_reduced_scoring(DEFAULT_ENABLED_REDUCED_SCORING_STATE); + $newSetRecord->open_date(time + ONE_WEEK()); + $newSetRecord->due_date(time + 2*ONE_WEEK() ); + $newSetRecord->answer_date(time + 2*ONE_WEEK() ); + $newSetRecord->published(DEFAULT_PUBLISHED_STATE()); # don't want students to see an empty set + $newSetRecord->enable_reduced_scoring(DEFAULT_ENABLED_REDUCED_SCORING_STATE()); $db->addGlobalSet($newSetRecord); } elsif ($type eq "copy") { return CGI::div({class => "ResultsWithError"}, "Failed to duplicate set: no set selected for duplication!") unless $oldSetID =~ /\S/; |