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

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 23 May 2003 14:08:40 -0000


matthew		Fri May 23 10:08:40 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	assesscalc.pm 
  Log:
  Perl does not automagically convert the string '"1"' to 1, so we must only 
  quote those parameters which are non-numeric.
  
  
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.5 loncom/interface/spreadsheet/assesscalc.pm:1.6
--- loncom/interface/spreadsheet/assesscalc.pm:1.5	Thu May 22 17:16:35 2003
+++ loncom/interface/spreadsheet/assesscalc.pm	Fri May 23 10:08:40 2003
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.5 2003/05/22 21:16:35 matthew Exp $
+# $Id: assesscalc.pm,v 1.6 2003/05/23 14:08:40 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -540,13 +540,11 @@
     while (my ($parm,$value) = each(%parameters)) {
         my $cell = 'A'.$self->get_row_number_from_key($parm);
         $f{$cell} = $parm;
-        $c{$parm} = '';
-        if ($value ne '') {
-            $c{$parm} = '"'.$value.'"';
-        }
+        $value = '"'.$value.'"' if ($value =~/[^0-9.]/);
+        $c{$parm} = $value;
     }
-    $self->formulas(%f);
-    $self->constants(%c);
+    $self->formulas(\%f);
+    $self->constants(\%c);
     $self->calcsheet();
     #
     # Store export row in cache