[LON-CAPA-cvs] cvs: loncom(version_1_2_X) /homework inputtags.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 06 Nov 2004 01:15:59 -0000


albertel		Fri Nov  5 20:15:59 2004 EDT

  Modified files:              (Branch: version_1_2_X)
    /loncom/homework	inputtags.pm 
  Log:
  - backport 1.154
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.149 loncom/homework/inputtags.pm:1.149.2.1
--- loncom/homework/inputtags.pm:1.149	Tue Aug  3 11:32:31 2004
+++ loncom/homework/inputtags.pm	Fri Nov  5 20:15:59 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.149 2004/08/03 15:32:31 albertel Exp $
+# $Id: inputtags.pm,v 1.149.2.1 2004/11/06 01:15:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -524,10 +524,15 @@
 
 sub setgradedata {
     my ($award,$msg,$id,$previously_used) = @_;
-    # if the student already has it correct, don't modify the status
-    if ($Apache::lonhomework::scantronmode && defined($ENV{'form.CODE'})) {
+    if ($Apache::lonhomework::scantronmode && 
+	&Apache::lonnet::validCODE($ENV{'form.CODE'})) {
 	$Apache::lonhomework::results{"resource.CODE"}=$ENV{'form.CODE'};
+    } elsif ($Apache::lonhomework::scantronmode && 
+	     $ENV{'form.CODE'} eq '' &&
+	     $Apache::lonhomework::history{"resource.CODE"} ne '') {
+	$Apache::lonhomework::results{"resource.CODE"}='';
     }
+
     if (!$Apache::lonhomework::scantronmode &&
 	$Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
 	$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
@@ -536,7 +541,10 @@
     } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
 	      /^correct/ || $Apache::lonhomework::scantronmode ||
 	      lc($Apache::lonhomework::problemstatus) eq 'no') {
-	#handle assignment of tries and solved status
+        # the student doesn't already have it correct,
+	# or we are in a mode (scantron orno problem status) where a correct 
+        # can become incorrect
+	# handle assignment of tries and solved status
 	my $solvemsg;
 	if ($Apache::lonhomework::scantronmode) {
 	    $solvemsg='correct_by_scantron';