--- loncom/interface/loncoursedata.pm 2003/02/13 14:49:16 1.45 +++ loncom/interface/loncoursedata.pm 2003/02/13 22:52:48 1.46 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: loncoursedata.pm,v 1.45 2003/02/13 14:49:16 matthew Exp $ +# $Id: loncoursedata.pm,v 1.46 2003/02/13 22:52:48 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -293,7 +293,8 @@ sub get_sequence_assessment_data { &Apache::lonnet::logthis('filename = '.$fn); ## ## use navmaps - my $navmap = Apache::lonnavmaps::navmap->new($fn.".bd",$fn."_parms.db",1,0); + my $navmap = Apache::lonnavmaps::navmap->new($fn.".db",$fn."_parms.db", + 1,0); if (!defined($navmap)) { return 'Can not open Coursemap'; } @@ -1346,7 +1347,7 @@ sub DownloadStudentCourseData { sub DownloadStudentCourseDataSeparate { my ($students,$checkDate,$cacheDB,$extract,$status,$courseID,$r,$c)=@_; - my $residualFile = '/home/httpd/perl/tmp/'.$courseID.'DownloadFile.db'; + my $residualFile = $Apache::lonnet::tmpdir.$courseID.'DownloadFile.db'; my $title = 'LON-CAPA Statistics'; my $heading = 'Download Course Data'; @@ -1427,7 +1428,7 @@ sub DownloadStudentCourseDataSeparate { sub CheckForResidualDownload { my ($cacheDB,$extract,$status,$courseID,$r,$c)=@_; - my $residualFile = '/home/httpd/perl/tmp/'.$courseID.'DownloadFile.db'; + my $residualFile = $Apache::lonnet::tmpdir.$courseID.'DownloadFile.db'; if(!-e $residualFile) { return 'OK'; } @@ -1491,6 +1492,66 @@ sub CheckForResidualDownload { return 'OK'; } + +################################################ +################################################ + +=pod + +=item &get_current_state($sname,$sdom,$symb,$courseid); + +Retrive the current status of a students performance. $sname and +$sdom are the only required parameters. If $symb is undef the results +of a &Apache::lonnet::currentdump() will be returned. +If $courseid is undef it will be retrieved from the environment. + +The return structure is based on &Apache::lonnet::currentdump. If +$symb is unspecified, all the students data is returned in a hash of +the form: +( + symb1 => { param1 => value1, param2 => value2 ... }, + symb2 => { param1 => value1, param2 => value2 ... }, +) + +If $symb is specified, a hash of +( + param1 => value1, + param2 => value2, +) +is returned. + +Eventually this routine will cache the results locally. + +If no data is found for $symb, or if the student has not performance data, +an empty list is returned. + +=cut + +################################################ +################################################ + +sub get_current_state { + my ($sname,$sdom,$symb,$courseid)=@_; + return undef if (! defined($sname) || ! defined($sdom)); + $courseid = $ENV{'request.course.id'} if (! defined($courseid)); + # For a first pass, just get a currentdump and return the requested + # results + my @tmp = &Apache::lonnet::currentdump($courseid,$sdom,$sname); + if (! ((scalar(@tmp) > 0) && ($tmp[0] !~ /^error:/)) ) { + &Apache::lonnet::logthis('error getting data for '.$sname.':'.$sdom. + 'in course '.$courseid); + return (); + } + my %student_data = @tmp; + if (! defined($symb)) { + return %student_data; + } elsif (exists($student_data{$symb})) { + return %{$student_data{$symb}}; + } else { + return (); + } +} + ################################################ ################################################