[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 21 Dec 2006 02:51:53 -0000
albertel Wed Dec 20 21:51:53 2006 EDT
Modified files:
/loncom/interface loncoursedata.pm
Log:
- propagate back ourt any errors taht occur while trying to fetch
data (and don't cache the failed get)
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.176 loncom/interface/loncoursedata.pm:1.177
--- loncom/interface/loncoursedata.pm:1.176 Fri Oct 6 15:02:20 2006
+++ loncom/interface/loncoursedata.pm Wed Dec 20 21:51:53 2006
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.176 2006/10/06 19:02:20 albertel Exp $
+# $Id: loncoursedata.pm,v 1.177 2006/12/21 02:51:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1427,18 +1427,17 @@
#
# Download students data
my $time_of_retrieval = time;
- my @tmp = &Apache::lonnet::currentdump($courseid,$sdom,$sname);
- if ((scalar(@tmp) > 0) && ($tmp[0] =~ /^error:/)) {
+ my %student_data = &Apache::lonnet::currentdump($courseid,$sdom,$sname);
+ if (&Apache::lonnet::error(%student_data)) {
&Apache::lonnet::logthis('error getting data for '.
$sname.':'.$sdom.' in course '.$courseid.
- ':'.$tmp[0]);
- $returnstatus = 'error getting data';
+ ':'.(%student_data)[0]);
+ $returnstatus =(%student_data)[0] ;
return ($returnstatus,undef);
}
- if (scalar(@tmp) < 1) {
+ if (scalar(keys(%student_data)) < 1) {
return ('no data',undef);
}
- my %student_data = @tmp;
my @Results = &store_student_data($sname,$sdom,$courseid,\%student_data);
#
# Set the students update time
@@ -1667,6 +1666,10 @@
($sdom,$sname,$courseid.'.db',
$Apache::lonnet::perlvar{'lonUsersDir'});
#
+ if ($modifiedtime == -1) {
+ return ('no data',undef);
+ }
+
my $student_id = &get_student_id($sname,$sdom);
my @Result = &Apache::lonmysql::get_rows($student_table,
"student_id ='$student_id'");
@@ -1910,7 +1913,7 @@
} else {
if ($status ne 'okay' && $status ne '') {
&Apache::lonnet::logthis('status = '.$status);
- return ();
+ return ('error: '.$status,undef);
}
my $returnhash = &get_student_data_from_performance_cache($sname,$sdom,
$symb,$courseid);