[LON-CAPA-cvs] cvs: loncom(version_1_0_2) /homework imageresponse.pm inputtags.pm matchresponse.pm optionresponse.pm radiobuttonresponse.pm rankresponse.pm response.pm /homework/caparesponse caparesponse.pm /interface lonquickgrades.pm /interface/spreadsheet assesscalc.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 23 Sep 2003 01:52:58 -0000


This is a MIME encoded message

--albertel1064281978
Content-Type: text/plain

albertel		Mon Sep 22 21:52:58 2003 EDT

  Modified files:              (Branch: version_1_0_2)
    /loncom/homework	imageresponse.pm inputtags.pm matchresponse.pm 
                    	optionresponse.pm radiobuttonresponse.pm 
                    	rankresponse.pm response.pm 
    /loncom/homework/caparesponse	caparesponse.pm 
    /loncom/interface	lonquickgrades.pm 
    /loncom/interface/spreadsheet	assesscalc.pm 
  Log:
  - backport changes to make problemstatus work better
  
  
--albertel1064281978
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20030922215258.txt"

Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.31 loncom/homework/imageresponse.pm:1.31.2.1
--- loncom/homework/imageresponse.pm:1.31	Mon Jun  9 18:42:49 2003
+++ loncom/homework/imageresponse.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.31 2003/06/09 22:42:49 albertel Exp $
+# $Id: imageresponse.pm,v 1.31.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -110,7 +110,7 @@
     if ($target eq 'tex') {$result.="\\vskip 0 mm \n";} else {$result.="<br />\n";}
     my $image=$Apache::response::foilgroup{"$name.image"};
     &Apache::lonxml::debug("image is $image");
-    if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ ) {
+    if ( &Apache::response::show_answer() ) {
       if ($target eq 'tex') {
 	$result.=$Apache::response::foilgroup{"$name.image"}."\\vskip 0 mm \n";
       } else {
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.114 loncom/homework/inputtags.pm:1.114.2.1
--- loncom/homework/inputtags.pm:1.114	Thu Aug 28 08:54:27 2003
+++ loncom/homework/inputtags.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.114 2003/08/28 12:54:27 sakharuk Exp $
+# $Id: inputtags.pm,v 1.114.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -454,7 +454,8 @@
       $message = "Unknown message: $award";
       $button=1;
   }
-  if (lc($Apache::lonhomework::problemstatus) eq 'no') {
+  if (lc($Apache::lonhomework::problemstatus) eq 'no'  && 
+      $Apache::inputtags::status[-1] ne 'SHOW_ANSWER') {
       $message = "Answer Submitted";
       $bgcolor=$possiblecolors{'correct'};
       $button=1;
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.20 loncom/homework/matchresponse.pm:1.20.2.1
--- loncom/homework/matchresponse.pm:1.20	Tue Jul  1 16:13:30 2003
+++ loncom/homework/matchresponse.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Full matching style response
 #
-# $Id: matchresponse.pm,v 1.20 2003/07/01 20:13:30 sakharuk Exp $
+# $Id: matchresponse.pm,v 1.20.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -370,7 +370,7 @@
 	%name_letter_map=
 	    %{ $Apache::response::itemgroup{'name_letter_map'} };
     }
-    if (($solved =~ /^correct/) || ($status eq  'SHOW_ANSWER')) {
+    if ( &Apache::response::show_answer() ) {
 	foreach my $name (@whichfoils) {
 	    my $text=$Apache::response::foilgroup{$name.'.text'};
 	    my $value=$Apache::response::foilgroup{$name.'.value'};
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.84 loncom/homework/optionresponse.pm:1.84.2.1
--- loncom/homework/optionresponse.pm:1.84	Fri Aug  1 15:04:06 2003
+++ loncom/homework/optionresponse.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.84 2003/08/01 19:04:06 sakharuk Exp $
+# $Id: optionresponse.pm,v 1.84.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -303,9 +303,8 @@
   my $break;
   my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
   my $status=$Apache::inputtags::status[-1];
-  if (
-      ($target ne 'tex') &&
-      (($solved =~ /^correct/) || ($status eq 'SHOW_ANSWER')) ) {
+  if ( ($target ne 'tex') &&
+       &Apache::response::show_answer() ) {
     foreach $name (@whichopt) {
 	my $text=$Apache::response::foilgroup{$name.'.text'};
 	if ($text!~/^\s*$/) {
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.72 loncom/homework/radiobuttonresponse.pm:1.72.2.1
--- loncom/homework/radiobuttonresponse.pm:1.72	Fri Jun 20 00:05:13 2003
+++ loncom/homework/radiobuttonresponse.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # mutliple choice style responses
 #
-# $Id: radiobuttonresponse.pm,v 1.72 2003/06/20 04:05:13 albertel Exp $
+# $Id: radiobuttonresponse.pm,v 1.72.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -205,7 +205,7 @@
   my $part=$Apache::inputtags::part;
   my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
   my %lastresponse=&Apache::lonnet::str2hash($lastresponse);
-  if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/)  || ($Apache::inputtags::status[-1] eq  'SHOW_ANSWER')) {
+  if (&Apache::response::show_answer() ) {
     foreach my $name (@names) {
       if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
 	$result.="<br />".$Apache::response::foilgroup{$name.'.value'};
@@ -373,7 +373,7 @@
   my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
   my $status=$Apache::inputtags::status[-1];
   if ( ($target ne 'tex') &&
-       (($solved =~ /^correct/) || ($status eq  'SHOW_ANSWER')) ) {
+       &Apache::response::show_answer() ) {
     foreach my $name (@whichfoils) {
       if ($target ne 'tex') {
 	  $result.="<br />";
Index: loncom/homework/rankresponse.pm
diff -u loncom/homework/rankresponse.pm:1.17 loncom/homework/rankresponse.pm:1.17.2.1
--- loncom/homework/rankresponse.pm:1.17	Mon Jul 21 15:42:17 2003
+++ loncom/homework/rankresponse.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # rank style response
 #
-# $Id: rankresponse.pm,v 1.17 2003/07/21 19:42:17 albertel Exp $
+# $Id: rankresponse.pm,v 1.17.2.1 2003/09/23 01:52:57 albertel Exp $
 # Copyright Michigan State University Board of Trustees
 #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -241,7 +241,7 @@
     my $status=$Apache::inputtags::status[-1];
     my @whichopt=(1..($#whichfoils+1));
     my @correctorder=&get_correct_order($tol,@whichfoils);
-    if (($solved =~ /^correct/) || ($status eq  'SHOW_ANSWER')) {
+    if ( &Apache::response::show_answer() ) {
 	foreach my $name (@whichfoils) {
 	    my $text=$Apache::response::foilgroup{$name.'.text'};
 	    my $value=shift(@correctorder);
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.82 loncom/homework/response.pm:1.82.2.1
--- loncom/homework/response.pm:1.82	Mon Jul 28 18:44:54 2003
+++ loncom/homework/response.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.82 2003/07/28 22:44:54 albertel Exp $
+# $Id: response.pm,v 1.82.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -512,6 +512,14 @@
     return @whichopt;
 }
 
+sub show_answer {
+    my $part   = $Apache::inputtags::part;
+    my $award  = $Apache::lonhomework::history{"resource.$part.solved"};
+    my $status = $Apache::inputtags::status[-1];
+    return  ( ($award =~ /^correct/
+	       && lc($Apache::lonhomework::problemstatus) ne 'no')
+	      || $status eq "SHOW_ANSWER");
+}
 1;
 __END__
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.107 loncom/homework/caparesponse/caparesponse.pm:1.107.2.1
--- loncom/homework/caparesponse/caparesponse.pm:1.107	Mon Jul 28 14:29:05 2003
+++ loncom/homework/caparesponse/caparesponse.pm	Mon Sep 22 21:52:57 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.107 2003/07/28 18:29:05 sakharuk Exp $
+# $Id: caparesponse.pm,v 1.107.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -169,10 +169,7 @@
 						     $safeeval);
 	my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
 	my $status = $Apache::inputtags::status['-1'];
-	if (   ($award =~ /^correct/
-                && lc($Apache::lonhomework::problemstatus) ne 'no')
-             || $status eq "SHOW_ANSWER"
-             || $ENV{'form.texaward'} eq 'SHOW_ANSWER') {
+	if (  &Apache::response::show_answer() ) {
 	    my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
 							 $safeeval);
 	    my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.22 loncom/interface/lonquickgrades.pm:1.22.2.1
--- loncom/interface/lonquickgrades.pm:1.22	Thu Jul 17 10:34:02 2003
+++ loncom/interface/lonquickgrades.pm	Mon Sep 22 21:52:57 2003
@@ -150,12 +150,11 @@
 		    }
 		    $totalParts += $curRes->weight($part);
 		} else {
-		    my $status = $curRes->getCompletionStatus($part);
+		    my $status = $curRes->status($part);
 		    my $thisright = 0;
 		    $partsCount++;
 		    if ($status == $curRes->CORRECT || 
-			$status == $curRes->CORRECT_BY_OVERRIDE || 
-			$status == $curRes->ANSWER_SUBMITTED) {
+			$status == $curRes->EXCUSED) {
 			$partsRight++;
 			$totalRight++;
 			$thisright = 1;
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.17 loncom/interface/spreadsheet/assesscalc.pm:1.17.2.1
--- loncom/interface/spreadsheet/assesscalc.pm:1.17	Tue Jul 29 01:22:56 2003
+++ loncom/interface/spreadsheet/assesscalc.pm	Mon Sep 22 21:52:57 2003
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.17 2003/07/29 05:22:56 albertel Exp $
+# $Id: assesscalc.pm,v 1.17.2.1 2003/09/23 01:52:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -594,7 +594,10 @@
         while (my ($parm,$value) = each(%parameters)) {
             last if ($self->blackout());
             next if ($parm !~ /^(parameter_.*)_problemstatus$/);
-            next if ($parameters{$1.'_answerdate'}<time);
+	    if ($parameters{$1.'_answerdate'} ne '' &&
+		$parameters{$1.'_answerdate'} < time) {
+		next;
+	    }
             if (lc($value) eq 'no') {
                 # We must blackout this sheet
                 $self->blackout(1);

--albertel1064281978--