--- loncom/interface/loncoursedata.pm 2003/06/17 21:45:36 1.78 +++ loncom/interface/loncoursedata.pm 2003/06/19 12:45:54 1.79 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.78 2003/06/17 21:45:36 matthew Exp $ +# $Id: loncoursedata.pm,v 1.79 2003/06/19 12:45:54 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -916,7 +916,7 @@ sub update_student_data { $sname.':'.$sdom.' in course '.$courseid. ':'.$tmp[0]); $returnstatus = 'error getting data'; - return $returnstatus; + return ($returnstatus,undef); } if (scalar(@tmp) < 1) { return ('no data',undef); @@ -940,7 +940,7 @@ sub update_student_data { my $num_parameters = 0; my $store_performance_command = 'INSERT INTO '.$performance_table. ' VALUES '."\n"; - return 'error' if (! defined($dbh)); + return ('error',undef) if (! defined($dbh)); while (my ($current_symb,$param_hash) = each(%student_data)) { # # make sure the symb is set up properly @@ -994,14 +994,14 @@ sub update_student_data { &Apache::lonnet::logthis(' bigass insert error:'.$dbh->errstr()); &Apache::lonnet::logthis('command = '.$store_parameters_command); $returnstatus = 'error: unable to insert parameters into database'; - return $returnstatus,\%student_data; + return ($returnstatus,\%student_data); } $dbh->do($store_performance_command); if ($dbh->err()) { &Apache::lonnet::logthis(' bigass insert error:'.$dbh->errstr()); &Apache::lonnet::logthis('command = '.$store_performance_command); $returnstatus = 'error: unable to insert performance into database'; - return $returnstatus,\%student_data; + return ($returnstatus,\%student_data); } $elapsed += Time::HiRes::time - $start; # @@ -1057,7 +1057,7 @@ sub ensure_current_data { !$found_student || !$found_part || !$found_performance || !$found_parameters) { if (&init_dbs($courseid)) { - return 'error'; + return ('error',undef); } } # @@ -1225,13 +1225,12 @@ sub get_current_state { # } # } # - if (defined($data)) { - if (defined($symb)) { - return %{$data->{$symb}}; - } else { - return %$data; - } - } elsif ($status eq 'no data') { + if (defined($data) && defined($symb) && ref($data->{$symb})) { + return %{$data->{$symb}}; + } elsif (defined($data) && ! defined($symb) && ref($data)) { + return %$data; + } + if ($status eq 'no data') { return (); } else { if ($status ne 'okay' && $status ne '') {