--- loncom/interface/spreadsheet/studentcalc.pm 2003/07/16 20:30:36 1.15 +++ loncom/interface/spreadsheet/studentcalc.pm 2003/09/05 01:06:45 1.17 @@ -1,5 +1,5 @@ # -# $Id: studentcalc.pm,v 1.15 2003/07/16 20:30:36 matthew Exp $ +# $Id: studentcalc.pm,v 1.17 2003/09/05 01:06:45 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -45,6 +45,9 @@ studentcalc ################################################### package Apache::studentcalc; +use warnings FATAL=>'all'; +no warnings 'uninitialized'; + use strict; use Apache::Constants qw(:common :http); use Apache::lonnet; @@ -98,8 +101,8 @@ sub initialize_sequence_cache { } sub clear_package { - @Sequences = undef; - %Exportrows = undef; + undef(@Sequences); + undef(%Exportrows); } sub get_title { @@ -411,7 +414,6 @@ sub outsheet_recursive_excel { sub compute { my $self = shift; - $self->logthis('computing'); if (! defined($current_course) || $current_course ne $ENV{'request.course.id'}) { $current_course = $ENV{'request.course.id'}; @@ -494,7 +496,7 @@ sub compute { sub set_row_sources { my $self = shift; while (my ($cell,$value) = each(%{$self->{'formulas'}})) { - next if ($cell !~ /^A(\d+)/ && $1 > 0); + next if ($cell !~ /^A(\d+)$/ || $1 < 1); my $row = $1; (undef,$value) = split('__&&&__',$value); $value = 'Default' if (! defined($value)); @@ -511,7 +513,7 @@ sub set_row_numbers { next if ($row == 0); my ($symb,undef) = split('__&&&__',$formula); $self->{'row_numbers'}->{$symb} = $row; - $self->{'maxrow'} = $1 if ($1 > $self->{'maxrow'}); + $self->{'maxrow'} = $row if ($row > $self->{'maxrow'}); } } @@ -541,7 +543,7 @@ These rows are saved in the courses dire ############################################# ############################################# sub load_cached_export_rows { - %Exportrows = undef; + undef(%Exportrows); my @tmp = &Apache::lonnet::dump('nohist_calculatedsheets', $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, $ENV{'course.'.$ENV{'request.course.id'}.'.num'},undef); @@ -589,7 +591,7 @@ sub save_export_data { my $newstore = join('___;___', @{$Exportrows{$student}->{'data'}}); $newstore = '___=___'.$newstore; - &Apache::lonnet::put('nohist_calculatedsheets', + my $result= &Apache::lonnet::put('nohist_calculatedsheets', { $key => $newstore, $timekey => $Exportrows{$student}->{'time'} }, $self->{'cdom'}, @@ -616,7 +618,10 @@ sub export_data { my $student = $self->{'name'}.':'.$self->{'domain'}; if (! exists($Exportrows{$student}) || ! defined($Exportrows{$student}) || + ! exists($Exportrows{$student}->{'data'}) || ! defined($Exportrows{$student}->{'data'}) || + ! exists($Exportrows{$student}->{'time'}) || + ! defined($Exportrows{$student}->{'time'}) || ! $self->check_expiration_time($Exportrows{$student}->{'time'})) { $self->compute(); }