[LON-CAPA-cvs] cvs: loncom /homework functionplotresponse.pm inputtags.pm /homework/templates customhints.problem

www www@source.lon-capa.org
Sun, 31 Oct 2010 12:33:08 -0000


www		Sun Oct 31 12:33:08 2010 EDT

  Modified files:              
    /loncom/homework	functionplotresponse.pm inputtags.pm 
    /loncom/homework/templates	customhints.problem 
  Log:
  Better return codes
  
  
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.20 loncom/homework/functionplotresponse.pm:1.21
--- loncom/homework/functionplotresponse.pm:1.20	Sat Oct 30 23:43:29 2010
+++ loncom/homework/functionplotresponse.pm	Sun Oct 31 12:33:02 2010
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: functionplotresponse.pm,v 1.20 2010/10/30 23:43:29 www Exp $
+# $Id: functionplotresponse.pm,v 1.21 2010/10/31 12:33:02 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -718,7 +718,7 @@
         $xmax=(defined($xmax)?$xmax:10);
         my $ad;
         if (&populate_arrays($internalid,$xmin,$xmax) eq 'no_func') {
-           $ad='BAD_FORMULA';
+           $ad='NOT_FUNCTION';
         } else {
            $ad='INCORRECT';
         }
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.271 loncom/homework/inputtags.pm:1.272
--- loncom/homework/inputtags.pm:1.271	Sun Sep  5 20:57:42 2010
+++ loncom/homework/inputtags.pm	Sun Oct 31 12:33:02 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.271 2010/09/05 20:57:42 raeburn Exp $
+# $Id: inputtags.pm,v 1.272 2010/10/31 12:33:02 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -659,7 +659,8 @@
 			       'UNIT_INVALID_STUDENT', 'UNIT_IRRECONCIBLE',
 			       'UNIT_FAIL', 'NO_UNIT',
 			       'UNIT_NOTNEEDED', 'WANTED_NUMERIC',
-			       'BAD_FORMULA', 'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT', 
+			       'BAD_FORMULA', 'NOT_FUNCTION', 'WRONG_FORMAT', 
+                               'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT', 
 			       'MISORDERED_RANK', 'INVALID_FILETYPE',
                                'EXCESS_FILESIZE', 'FILENAME_INUSE', 
 			       'DRAFT', 'SUBMITTED', 'SUBMITTED_CREDIT', 
@@ -676,7 +677,8 @@
 		  'TOO_LONG',
 		  'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT',
 		  'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT',
-		  'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'INTERNAL_ERROR',
+		  'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA',  'NOT_FUNCTION', 
+                  'WRONG_FORMAT', 'INTERNAL_ERROR',
 		  'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK',
 		  'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'FILENAME_INUSE', 
                   'DRAFT', 'SUBMITTED',
@@ -963,7 +965,15 @@
         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') {
+    } elsif ($award eq 'NOT_FUNCTION') {
+        $message = &mt("Not a function").'.';
+        $css_class=$possible_class{'not_charged_try'};
+        $button=1;
+    } elsif ($award eq 'WRONG_FORMAT') {
+        $message = &mt("Wrong format").'.';
+        $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;
Index: loncom/homework/templates/customhints.problem
diff -u loncom/homework/templates/customhints.problem:1.2 loncom/homework/templates/customhints.problem:1.3
--- loncom/homework/templates/customhints.problem:1.2	Sat May 15 12:58:43 2010
+++ loncom/homework/templates/customhints.problem	Sun Oct 31 12:33:08 2010
@@ -34,7 +34,7 @@
 <customresponse answerdisplay="$possible" id="11">
     <answer type="loncapa/perl"># Analyze the format
 ($formaterror,$doubleerror)=&analyze($submission);
-if ($formaterror || $doubleerror) { return 'BAD_FORMULA'; }
+if ($formaterror || $doubleerror) { return 'WRONG_FORMAT'; }
 # It is an Egyptian Fraction, is the value correct?
 if (&cas('maxima',$submission.'-('.$egyptian.')') eq '0') {
     return 'EXACT_ANS';