[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Tue, 29 Oct 2002 16:04:13 -0000
matthew Tue Oct 29 11:04:13 2002 EDT
Modified files:
/loncom/interface lonspreadsheet.pm
Log:
Fixes bug which caused some cells to not be exported up from the student
spreadsheet. &exportdata was modified to not return values of undef.
&loadcourse was modified to use named parameters to pass values to
&exportsheet. It was also modified to do a if (defined(*value*)) instead of
if (*value). Some strings appearantly are false, despite being nonzero and
of non-zero length.
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.129 loncom/interface/lonspreadsheet.pm:1.130
--- loncom/interface/lonspreadsheet.pm:1.129 Fri Oct 25 15:47:14 2002
+++ loncom/interface/lonspreadsheet.pm Tue Oct 29 11:04:13 2002
@@ -1,5 +1,5 @@
#
-# $Id: lonspreadsheet.pm,v 1.129 2002/10/25 19:47:14 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.130 2002/10/29 16:04:13 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1095,7 +1095,11 @@
my @exportarray=();
foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') {
- push(@exportarray,$sheet->{'values'}->{$_.'0'});
+ if (exists($sheet->{'values'}->{$_.'0'})) {
+ push(@exportarray,$sheet->{'values'}->{$_.'0'});
+ } else {
+ push(@exportarray,'');
+ }
}
return @exportarray;
}
@@ -1927,8 +1931,8 @@
next if ($_!~/^A(\d+)/);
my $row=$1;
next if (($f{$_}=~/^[\!\~\-]/) || ($row==0));
- my @studentdata=&exportsheet($sheet,split(/\:/,$f{$_}),
- 'studentcalc');
+ my ($sname,$sdom) = split(':',$f{$_});
+ my @studentdata=&exportsheet($sheet,$sname,$sdom,'studentcalc');
undef %userrdatas;
$now++;
$r->print('<script>popwin.document.popremain.remaining.value="'.
@@ -1939,7 +1943,7 @@
my $index=0;
foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') {
- if ($studentdata[$index]) {
+ if (defined($studentdata[$index++])) {
my $col=$_;
if ($studentdata[$index]=~/\D/) {
$c{$col.$row}="'".$studentdata[$index]."'";
@@ -1949,7 +1953,6 @@
unless ($col eq 'A') {
$f{$col.$row}='import';
}
- $index++;
}
}
}