[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm lonhomework.pm structuretags.pm /homework/caparesponse caparesponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 09 May 2003 22:24:05 -0000


albertel		Fri May  9 18:24:05 2003 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm inputtags.pm structuretags.pm 
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - some of BUG#628, also needed for online exams, disable feedback to students about whether they are correct or not.
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.122 loncom/homework/lonhomework.pm:1.123
--- loncom/homework/lonhomework.pm:1.122	Fri May  9 13:01:08 2003
+++ loncom/homework/lonhomework.pm	Fri May  9 18:24:05 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.122 2003/05/09 17:01:08 albertel Exp $
+# $Id: lonhomework.pm,v 1.123 2003/05/09 22:24:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -214,7 +214,8 @@
     if ( $tries eq '' ) { $tries = '0'; }
     if ( $maxtries eq '' ) { $maxtries = '2'; } 
     if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } 
-    if($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/) {
+    if($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/
+      && lc($Apache::lonhomework::problemstatus) ne 'no') {
 	$status = 'CANNOT_ANSWER';
     }
   }
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.100 loncom/homework/inputtags.pm:1.101
--- loncom/homework/inputtags.pm:1.100	Thu May  8 11:33:15 2003
+++ loncom/homework/inputtags.pm	Fri May  9 18:24:05 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.100 2003/05/08 15:33:15 albertel Exp $
+# $Id: inputtags.pm,v 1.101 2003/05/09 22:24:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -404,7 +404,8 @@
     $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;
     return '';
   } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
-       /^correct/ || $Apache::lonhomework::scantronmode) {
+       /^correct/ || $Apache::lonhomework::scantronmode ||
+	    lc($Apache::lonhomework::problemstatus) eq 'no') {
     #handle assignment of tries and solved status
     my $solvemsg;
     if ($Apache::lonhomework::scantronmode) {
@@ -456,13 +457,19 @@
     } else {
       $Apache::lonhomework::results{"resource.$id.solved"} =
 	'incorrect_attempted';
+      if (lc($Apache::lonhomework::problemstatus) eq 'no') {
+	  $Apache::lonhomework::results{"resource.$id.tries"} =
+	      $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+      }
     }
 
     # check if this was a previous submission if it was delete the
     # unneeded data and update the previously_used attribute
     if ( $previously_used eq 'PREVIOUSLY_USED') {
-      delete($Apache::lonhomework::results{"resource.$id.tries"});
-      $Apache::lonhomework::results{"resource.$id.previous"} = '1';
+	if (lc($Apache::lonhomework::problemstatus) ne 'no') {
+	    delete($Apache::lonhomework::results{"resource.$id.tries"});
+	    $Apache::lonhomework::results{"resource.$id.previous"} = '1';
+	}
     } elsif ( $previously_used eq 'PREVIOUSLY_LAST') {
       #delete all data as they student didn't do anything, but save
       #the list of collaborators.
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.168 loncom/homework/structuretags.pm:1.169
--- loncom/homework/structuretags.pm:1.168	Sun May  4 04:00:31 2003
+++ loncom/homework/structuretags.pm	Fri May  9 18:24:05 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.168 2003/05/04 08:00:31 albertel Exp $
+# $Id: structuretags.pm,v 1.169 2003/05/09 22:24:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -272,6 +272,8 @@
     @Apache::structuretags::whilebody=();
     @Apache::structuretags::whileline=();
     $Apache::lonhomework::scantronmode=0;
+    $Apache::lonhomework::problemstatus=
+	&Apache::lonnet::EXT('resource.0.problemstatus');
 
     if (defined($ENV{'scantron.maxquest'})) {
 	$Apache::lonhomework::scantronmode=1;
@@ -814,6 +816,8 @@
     @Apache::inputtags::responselist = ();
     @Apache::inputtags::previous=();
     @Apache::inputtags::previous_version=();
+    $Apache::lonhomework::problemstatus=
+	&Apache::lonnet::EXT("resource.$id.problemstatus");
     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
 
     if ($target eq 'meta') {
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.96 loncom/homework/caparesponse/caparesponse.pm:1.97
--- loncom/homework/caparesponse/caparesponse.pm:1.96	Fri May  9 18:00:16 2003
+++ loncom/homework/caparesponse/caparesponse.pm	Fri May  9 18:24:05 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.96 2003/05/09 22:00:16 albertel Exp $
+# $Id: caparesponse.pm,v 1.97 2003/05/09 22:24:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -165,7 +165,10 @@
 						     $safeeval);
 	my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
 	my $status = $Apache::inputtags::status['-1'];
-	if ($award =~ /^correct/ || $status eq "SHOW_ANSWER" || $ENV{'form.texaward'} eq 'SHOW_ANSWER') {
+	if (   ($award =~ /^correct/
+                && lc($Apache::lonhomework::problemstatus) ne 'no')
+             || $status eq "SHOW_ANSWER"
+             || $ENV{'form.texaward'} eq 'SHOW_ANSWER') {
 	    my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
 							 $safeeval);
 	    my $unit=&Apache::lonxml::get_param_var('unit',$parstack,