--- loncom/interface/loncoursedata.pm 2002/10/14 19:06:21 1.35 +++ loncom/interface/loncoursedata.pm 2003/01/31 22:34:38 1.43 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: loncoursedata.pm,v 1.35 2002/10/14 19:06:21 matthew Exp $ +# $Id: loncoursedata.pm,v 1.43 2003/01/31 22:34:38 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -218,7 +218,8 @@ sub DownloadCourseInformation { $courseID.'.db', $Apache::lonnet::perlvar{'lonUsersDir'}); - if($lastDownloadTime >= $modifiedTime && $modifiedTime >= 0) { + if($lastDownloadTime ne 'Not downloaded' && + $lastDownloadTime >= $modifiedTime && $modifiedTime >= 0) { # Data is not gathered so return UpToDate as true. This # will be interpreted in ProcessClasslist $courseData{$namedata.':lastDownloadTime'}=time; @@ -310,6 +311,7 @@ sub ProcessTopResourceMap { } my $oldkeys; + delete $cache->{'OptionResponses'}; if(defined($cache->{'ResourceKeys'})) { $oldkeys = $cache->{'ResourceKeys'}; foreach (split(':::', $cache->{'ResourceKeys'})) { @@ -487,9 +489,9 @@ sub ProcessTopResourceMap { } my @titleLength=split(//,$cache->{$currentSequence. ':title'}); - # $extra is 3 for problems correct and 3 for space + # $extra is 5 for problems correct and 3 for space # between problems correct and problem output - my $extra = 6; + my $extra = 8; if(($totalProblems + $extra) > (scalar @titleLength)) { $cache->{$currentSequence.':columnWidth'}= $totalProblems + $extra; @@ -518,7 +520,7 @@ sub ProcessTopResourceMap { # big problem, need to handle. Next is probably wrong my $errorMessage = 'Big problem in '; $errorMessage .= 'loncoursedata::ProcessTopLevelMap.'; - $errorMessage .= ' bighash to_$currentResourceID not defined!'; + $errorMessage .= " bighash to_$currentResourceID not defined!"; &Apache::lonnet::logthis($errorMessage); last; } @@ -1179,7 +1181,7 @@ sub DownloadStudentCourseData { my $WhatIWant; $WhatIWant = '(^version:|'; $WhatIWant .= '^\d+:.+?:(resource\.\d+\.'; - $WhatIWant .= '(solved|tries|previous|awarded|(\d+\.submission))\s*$'; + $WhatIWant .= '(solved|tries|previous|awarded|(\d+\.submission))\s*$';#' $WhatIWant .= '|timestamp)'; $WhatIWant .= ')'; # $WhatIWant = '.'; @@ -1429,7 +1431,7 @@ sub get_classlist { ($end,$start,$id,$section,$fullname) = @Values; } else { # We have to get the data ourselves ($end,$start) = @Values; - $section = &Apache::lonnet::usection($sdom,$sname,$cid); + $section = &Apache::lonnet::getsection($sdom,$sname,$cid); my %info=&Apache::lonnet::get('environment', ['firstname','middlename', 'lastname','generation','id'], @@ -1438,14 +1440,25 @@ sub get_classlist { if ($tmp =~/^(con_lost|error|no_such_host)/i) { $fullname = 'not available'; $id = 'not available'; + &Apache::lonnet::logthis('unable to retrieve environment '. + 'for '.$sname.':'.$sdom); } else { $fullname = &ProcessFullName(@info{qw/lastname generation firstname middlename/}); $id = $info{'id'}; } - # At this point, if we have the data (check for 'not available's - # we could put it back into the classlist.db file. - # We have not decided to do that yet. + # Update the classlist with this students information + if ($fullname ne 'not available') { + my $enrolldata = join(':',$end,$start,$id,$section,$fullname); + my $reply=&Apache::lonnet::cput('classlist', + {$student => $enrolldata}, + $cdom,$cnum); + if ($reply !~ /^(ok|delayed)/) { + &Apache::lonnet::logthis('Unable to update classlist for '. + 'student '.$sname.':'.$sdom. + ' error:'.$reply); + } + } } my $status='Expired'; if(((!$end) || $now < $end) && ((!$start) || ($now > $start))) { @@ -1467,3 +1480,4 @@ sub get_classlist { 1; __END__ +