[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm response.pm /xml lonxml.pm
www
www@source.lon-capa.org
Sun, 07 Dec 2008 23:41:03 -0000
www Sun Dec 7 23:41:03 2008 EDT
Modified files:
/loncom/homework inputtags.pm response.pm
/loncom/xml lonxml.pm
Log:
Detect if there were timeouts or other internal errors during grading.
Do not charge a try, allow student to enter same answer again.
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.250 loncom/homework/inputtags.pm:1.251
--- loncom/homework/inputtags.pm:1.250 Sat Dec 6 12:49:12 2008
+++ loncom/homework/inputtags.pm Sun Dec 7 23:40:57 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.250 2008/12/06 12:49:12 bisitz Exp $
+# $Id: inputtags.pm,v 1.251 2008/12/07 23:40:57 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -562,7 +562,7 @@
'UNIT_INVALID_STUDENT', 'UNIT_IRRECONCIBLE',
'UNIT_FAIL', 'NO_UNIT',
'UNIT_NOTNEEDED', 'WANTED_NUMERIC',
- 'BAD_FORMULA', 'SIG_FAIL', 'INCORRECT',
+ 'BAD_FORMULA', 'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT',
'MISORDERED_RANK', 'INVALID_FILETYPE',
'EXCESS_FILESIZE', 'DRAFT',
'SUBMITTED', 'ASSIGNED_SCORE',
@@ -577,7 +577,7 @@
'TOO_LONG',
'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT',
'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT',
- 'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA',
+ 'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'INTERNAL_ERROR',
'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK',
'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'DRAFT', 'SUBMITTED',
'ASSIGNED_SCORE', 'APPROX_ANS', 'EXACT_ANS');
@@ -625,6 +625,9 @@
return ('NO_RESPONSE');
}
}
+
+ if ($Apache::lonxml::internal_error) { $result='INTERNAL_ERROR'; }
+
if (!$final_scantron && defined($result)) { return ($result); }
# if in scantron mode, if the award for any response is
@@ -671,6 +674,7 @@
sub decideoutput {
my ($award,$awarded,$awardmsg,$solved,$previous,$target)=@_;
+
my $message='';
my $button=0;
my $previousmsg;
@@ -805,7 +809,6 @@
$message = &mt('Submission won\'t be graded. The combined size of submitted files exceeded the amount allowed.');
$css_class=$possible_class{'not_charged_try'};
$button=1;
-
} elsif ($award eq 'INVALID_FILETYPE') {
$message = &mt('Submission won\'t be graded. The type of file submitted is not allowed.');
$css_class=$possible_class{'not_charged_try'};
@@ -849,6 +852,10 @@
if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Formula_Answers')};
$css_class=$possible_class{'not_charged_try'};
$button=1;
+ } elsif ($award eq 'INTERNAL_ERROR') {
+ $message = &mt("An internal error occurred while processing your answer. Please try again later.");
+ $css_class=$possible_class{'not_charged_try'};
+ $button=1;
} elsif ($award eq 'INCORRECT') {
$message = &mt("Incorrect").'.';
$css_class=$possible_class{'charged_try'};
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.208 loncom/homework/response.pm:1.209
--- loncom/homework/response.pm:1.208 Tue Nov 25 13:16:17 2008
+++ loncom/homework/response.pm Sun Dec 7 23:40:57 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.208 2008/11/25 13:16:17 jms Exp $
+# $Id: response.pm,v 1.209 2008/12/07 23:40:57 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -316,6 +316,7 @@
$previous{'last'}='1';
}
if (! $previous{'award'} ) { $previous{'award'} = 'UNKNOWN'; }
+ if ($previous{'award'} eq 'INTERNAL_ERROR') { $previous{'used'}=0; }
&Apache::lonxml::debug("got a match :$previous{'award'}:$previous{'used'}:");
}
}
@@ -1336,4 +1337,4 @@
=back
-=cut
\ No newline at end of file
+=cut
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.489 loncom/xml/lonxml.pm:1.490
--- loncom/xml/lonxml.pm:1.489 Mon Nov 24 17:17:52 2008
+++ loncom/xml/lonxml.pm Sun Dec 7 23:41:02 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.489 2008/11/24 17:17:52 jms Exp $
+# $Id: lonxml.pm,v 1.490 2008/12/07 23:41:02 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -677,6 +677,7 @@
$Apache::lonxml::request=$request;
$errorcount=0;
$warningcount=0;
+ $Apache::lonxml::internal_error=0;
$Apache::lonxml::default_homework_loaded=0;
$Apache::lonxml::usestyle=1;
&init_counter();
@@ -1847,6 +1848,8 @@
$errorcount++;
+ $Apache::lonxml::internal_error=1;
+
if (defined($Apache::inputtags::part)) {
if ( @Apache::inputtags::response ) {
push(@errors,