--- loncom/interface/lonstatistics.pm 2003/03/25 22:20:25 1.65 +++ loncom/interface/lonstatistics.pm 2003/05/12 22:07:17 1.68 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstatistics.pm,v 1.65 2003/03/25 22:20:25 matthew Exp $ +# $Id: lonstatistics.pm,v 1.68 2003/05/12 22:07:17 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -51,7 +51,7 @@ Main handler for statistics and chart. use Apache::lonproblemstatistics; use Apache::lonstudentassessment; use Apache::lonpercentage; - + use Apache::lonmysql; =over 4 =cut @@ -82,6 +82,7 @@ use Apache::lonproblemanalysis(); use Apache::lonproblemstatistics(); use Apache::lonstudentassessment(); use Apache::lonpercentage; +use Apache::lonmysql; use Time::HiRes; ####################################################### @@ -239,6 +240,10 @@ sub PrepareClasslist { } # + # get the status requested + my $requested_status = 'Active'; + $requested_status = $ENV{'form.Status'} if (exists($ENV{'form.Status'})); + # # Process the classlist while (my ($student,$student_data) = each (%$classlist)) { my $studenthash = (); @@ -265,7 +270,11 @@ sub PrepareClasslist { # # Only put in the list those students we are interested in foreach my $sect (@SelectedSections) { - if (($sect eq 'all') || ($section eq $sect)) { + if ( (($sect eq 'all') || + ($section eq $sect)) && + (($studenthash->{'status'} eq $requested_status) || + ($requested_status eq 'Any')) + ){ push (@Students,$studenthash); last; } @@ -831,12 +840,16 @@ sub CreateMainMenu { # $Str .= ''."\n"; $Str .= ''."\n"; + $Str .= ''."\n"; $Str .= ''."\n"; - $Str .= ''."\n"; $Str .= ''."\n"; # - $Str .= '\n"; + $Str .= '\n"; # $Str .= ''."\n"; # - $Str .= ''."\n"; - # $Str .= '
Select a ReportStudent Status
'. + "'. + ''. + "'; $Str .= ''; - $Str .= &Apache::lonhtmlcommon::StatusOptions($status, 'Statistics'); - $Str .= '
'."\n"; $Str .= '
'."\n"; # @@ -908,6 +917,27 @@ sub handler { $r->print(&Apache::lonhtmlcommon::Title('Course Statistics and Charts')); $r->rflush(); # + if (! &Apache::lonmysql::verify_sql_connection()) { + my $serveradmin = $r->dir_config('lonAdmEMail'); + $r->print(<Unable to connect to database! +

+Please notify the server administrator $serveradmin. +

+Course Statistics and Charts cannot be retrieved until the database is +restarted. Your data is intact but cannot be displayed at this time. +

+ + +END + return; + } + # + # Clean out the caches + if (exists($ENV{'form.ClearCache'})) { + &Apache::loncoursedata::delete_caches($ENV{'requres.course.id'}); + } + # # Set up the statistics and chart environment &PrepareClasslist($r); &PrepareCourseData($r); @@ -919,7 +949,7 @@ sub handler { # Print main menu my %reports = ('classlist' => 'Class list', 'problem_statistics' => 'Problem Statistics', - 'student_assessment' => 'Student Assessment', + 'student_assessment' => 'Problem Status Chart', 'percentage' => 'Correct-problems Plot', 'option_response' => 'Option Response Analysis', # 'activitylog' => 'Activity Log',