--- loncom/interface/spreadsheet/assesscalc.pm 2003/12/05 22:24:20 1.17.2.3 +++ loncom/interface/spreadsheet/assesscalc.pm 2003/09/05 01:06:45 1.18 @@ -1,5 +1,5 @@ # -# $Id: assesscalc.pm,v 1.17.2.3 2003/12/05 22:24:20 matthew Exp $ +# $Id: assesscalc.pm,v 1.18 2003/09/05 01:06:45 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,11 +44,12 @@ assesscalc package Apache::assesscalc; use strict; +use warnings FATAL=>'all'; +no warnings 'uninitialized'; use Apache::Constants qw(:common :http); use Apache::lonnet; use Apache::loncommon; use Apache::Spreadsheet; -use Apache::loncoursedata(); use HTML::Entities(); use Spreadsheet::WriteExcel; use GDBM_File; @@ -126,7 +127,6 @@ sub clear_package { sub initialize { &clear_package(); - &Apache::loncoursedata::clear_internal_caches(); } ######################################################## @@ -150,7 +150,6 @@ sub initialize_package { } &load_cached_export_rows(); &load_parameter_caches(); - &Apache::loncoursedata::clear_internal_caches(); } ######################################################## @@ -170,7 +169,6 @@ sub load_parameter_caches { # # Course Parameters Cache if (! %courseopt) { - &Apache::lonnet::logthis("loading course options"); $current_course = $ENV{'request.course.id'}; undef(%courseopt); if (! defined($current_name) || ! defined($current_domain)) { @@ -374,10 +372,6 @@ sub parent_link { sub outsheet_html { my $self = shift; my ($r) = @_; - #################################### - # Report any calculation errors # - #################################### - $r->print($self->html_report_error()); ################################### # Determine table structure ################################### @@ -601,10 +595,7 @@ sub compute { while (my ($parm,$value) = each(%parameters)) { last if ($self->blackout()); next if ($parm !~ /^(parameter_.*)_problemstatus$/); - if ($parameters{$1.'_answerdate'} ne '' && - $parameters{$1.'_answerdate'} < time) { - next; - } + next if ($parameters{$1.'_answerdate'}blackout(1); @@ -699,7 +690,7 @@ These rows are saved in the students dir ######################################################## ######################################################## sub load_cached_export_rows { - %Exportrows = undef; + undef(%Exportrows); my @tmp = &Apache::lonnet::dump('nohist_calculatedsheets_'. $ENV{'request.course.id'}, $current_domain,$current_name,undef); @@ -745,23 +736,18 @@ sub export_data { ! exists($Exportrows{$symb}) || ! defined($Exportrows{$symb}) || ! $self->check_expiration_time($Exportrows{$symb}->{'time'}) || ! exists($Exportrows{$symb}->{$self->{'filename'}}) || - ! defined($Exportrows{$symb}->{$self->{'filename'}})) { + ! defined($Exportrows{$symb}->{$self->{'filename'}}) || + ! ref($Exportrows{$symb}->{$self->{'filename'}}) + ) { $self->compute(); } - my @Data; - if ($self->badcalc()) { - @Data = (); - } else { - @Data = @{$Exportrows{$symb}->{$self->{'filename'}}}; - if ($Data[0] =~ /^(.*)___=___/) { - $self->{'sheetname'} = $1; - $Data[0] =~ s/^(.*)___=___//; - } - for (my $i=0;$i<$#Data;$i++) { - if ($Data[$i]=~/\D/ && defined($Data[$i])) { - $Data[$i]="'".$Data[$i]."'"; - } - } + my @Data = @{$Exportrows{$symb}->{$self->{'filename'}}}; + if ($Data[0] =~ /^(.*)___=___/) { + $self->{'sheetname'} = $1; + $Data[0] =~ s/^(.*)___=___//; + } + for (my $i=0;$i<$#Data;$i++) { + $Data[$i]="'".$Data[$i]."'" if ($Data[$i]=~/\D/ && defined($Data[$i])); } return @Data; } @@ -784,11 +770,6 @@ sub save_export_data { return if ($self->temporary()); my $student = $self->{'name'}.':'.$self->{'domain'}; my $symb = $self->{'symb'}; - if ($self->badcalc()){ - # do not save data away when calculations have not been done properly. - delete($Exportrows{$symb}); - return; - } if (! exists($Exportrows{$symb}) || ! exists($Exportrows{$symb}->{$self->{'filename'}})) { return;