[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sun, 20 Jan 2008 01:52:48 -0000


raeburn		Sat Jan 19 20:52:48 2008 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Explicitly request a scalar from &parmval() - see bug 5578.  
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.409 loncom/interface/lonnavmaps.pm:1.410
--- loncom/interface/lonnavmaps.pm:1.409	Sat Jan 12 00:04:35 2008
+++ loncom/interface/lonnavmaps.pm	Sat Jan 19 20:52:47 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.409 2008/01/12 05:04:35 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.410 2008/01/20 01:52:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3440,11 +3440,13 @@
 sub randomout { my $self=shift; return $self->navHash("randomout_", 1); }
 sub randompick { 
     my $self = shift;
-    return $self->parmval('randompick');
+    my $randompick = $self->parmval('randompick');
+    return $randompick;
 }
 sub randomorder { 
     my $self = shift;
-    return ($self->parmval('randomorder') =~ /^yes$/i);
+    my $randomorder = $self->parmval('randomorder');
+    return ($randomorder =~ /^yes$/i);
 }
 sub link {
     my $self=shift;
@@ -3565,7 +3567,8 @@
 
 sub is_exam {
     my ($self,$part) = @_;
-    if ($self->parmval('type',$part) eq 'exam') {
+    my $type = $self->parmval('type',$part);
+    if ($type eq 'exam') {
         return 1;
     }
     if ($self->src() =~ /\.(exam)$/) {
@@ -3588,7 +3591,8 @@
 sub is_practice {
     my $self=shift;
     my ($part) = @_;
-    if ($self->parmval('type',$part) eq 'practice') {
+    my $type = $self->parmval('type',$part);
+    if ($type eq 'practice') {
         return 1;
     }
     return 0;
@@ -3626,7 +3630,8 @@
 sub is_survey {
     my $self = shift();
     my $part = shift();
-    if ($self->parmval('type',$part) eq 'survey') {
+    my $type = $self->parmval('type',$part);
+    if ($type eq 'survey') {
         return 1;
     }
     if ($self->src() =~ /\.(survey)$/) {
@@ -3802,16 +3807,19 @@
 
 sub acc {
     (my $self, my $part) = @_;
-    return $self->parmval("acc", $part);
+    my $acc = $self->parmval("acc", $part);
+    return $acc;
 }
 sub answerdate {
     (my $self, my $part) = @_;
     # Handle intervals
-    if ($self->parmval("answerdate.type", $part) eq 'date_interval') {
-        return $self->duedate($part) + 
-            $self->parmval("answerdate", $part);
+    my $answerdatetype = $self->parmval("answerdate.type", $part);
+    my $answerdate = $self->parmval("answerdate", $part);
+    my $duedate = $self->parmval("duedate", $part);
+    if ($answerdatetype eq 'date_interval') {
+        $answerdate = $duedate + $answerdate; 
     }
-    return $self->parmval("answerdate", $part);
+    return $answerdate;
 }
 sub awarded { 
     my $self = shift; my $part = shift;
@@ -3845,39 +3853,46 @@
     my @response_ids = $self->responseIds($part);
     if (@response_ids) {
 	foreach my $response_id (@response_ids) {
-	    if (lc($self->parmval("handgrade",$part.'_'.$response_id))
-		eq 'yes') {
+            my $handgrade = $self->parmval("handgrade",$part.'_'.$response_id);
+	    if (lc($handgrade) eq 'yes') {
 		return 'yes';
 	    }
 	}
     }
-    return $self->parmval("handgrade", $part);
+    my $handgrade = $self->parmval("handgrade", $part);
+    return $handgrade;
 }
 sub maxtries {
     (my $self, my $part) = @_;
-    return $self->parmval("maxtries", $part);
+    my $maxtries = $self->parmval("maxtries", $part);
+    return $maxtries;
 }
 sub opendate {
     (my $self, my $part) = @_;
-    if ($self->parmval("opendate.type", $part) eq 'date_interval') {
-        return $self->duedate($part) -
-            $self->parmval("opendate", $part);
+    my $opendatetype = $self->parmval("opendate.type", $part);
+    my $opendate = $self->parmval("opendate", $part); 
+    if ($opendatetype eq 'date_interval') {
+        my $duedate = $self->duedate($part);
+        $opendate = $duedate - $opendate; 
     }
-    return $self->parmval("opendate");
+    return $opendate;
 }
 sub problemstatus {
     (my $self, my $part) = @_;
-    return lc $self->parmval("problemstatus", $part);
+    my $problemstatus = $self->parmval("problemstatus", $part);
+    return lc($problemstatus);
 }
 sub sig {
     (my $self, my $part) = @_;
-    return $self->parmval("sig", $part);
+    my $sig = $self->parmval("sig", $part);
+    return $sig;
 }
 sub tol {
     (my $self, my $part) = @_;
-    return $self->parmval("tol", $part);
+    my $tol = $self->parmval("tol", $part);
+    return $tol;
 }
-sub tries { 
+sub tries {
     my $self = shift; 
     my $tries = $self->queryRestoreHash('tries', shift);
     if (!defined($tries)) { return '0';}
@@ -3885,7 +3900,8 @@
 }
 sub type {
     (my $self, my $part) = @_;
-    return $self->parmval("type", $part);
+    my $type = $self->parmval("type", $part);
+    return $type;
 }
 sub weight { 
     my $self = shift; my $part = shift;