--- loncom/interface/statistics/lonproblemstatistics.pm 2005/04/07 06:56:24 1.104 +++ loncom/interface/statistics/lonproblemstatistics.pm 2006/05/05 20:03:43 1.108 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemstatistics.pm,v 1.104 2005/04/07 06:56:24 albertel Exp $ +# $Id: lonproblemstatistics.pm,v 1.108 2006/05/05 20:03:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -608,11 +608,12 @@ sub CreateInterface { &parse_field_selection(); # my $Str = ''; - $Str .= &Apache::lonhtmlcommon::breadcrumbs - (undef,'Overall Problem Statistics','Statistics_Overall_Key'); + $Str .= &Apache::lonhtmlcommon::breadcrumbs('Overall Problem Statistics', + 'Statistics_Overall_Key'); $Str .= '<table cellspacing="5">'."\n"; $Str .= '<tr>'; $Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>'; + $Str .= '<td align="center"><b>'.&mt('Groups').'</b></td>'; $Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>'; $Str .= '<td align="center"><b>'.&mt('Sequences and Folders').'</b></td>'; $Str .= '<td align="center"><b>'.&mt('Statistics').'</b></td>'; @@ -623,6 +624,8 @@ sub CreateInterface { $Str .= '<tr><td align="center">'."\n"; $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= '</td><td align="center">'; + $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5); + $Str .= '</td><td align="center">'; $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); $Str .= '</td><td align="center">'; # @@ -661,6 +664,11 @@ Main interface to problem statistics. my $navmap; my @sequences; +sub clean_up { + undef($navmap); + undef(@sequences); +} + sub BuildProblemStatisticsPage { my ($r,$c)=@_; undef($navmap); @@ -669,6 +677,7 @@ sub BuildProblemStatisticsPage { my %Saveable_Parameters = ('Status' => 'scalar', 'statsoutputmode' => 'scalar', 'Section' => 'array', + 'Groups' => 'array', 'StudentData' => 'array', 'Maps' => 'array', 'fieldselections'=> 'array'); @@ -705,6 +714,7 @@ sub BuildProblemStatisticsPage { 'for the first analysis. Future analysis this session '. ' will not have this delay.'). '</p>'); + &clean_up(); return; } $r->rflush(); @@ -718,6 +728,7 @@ sub BuildProblemStatisticsPage { if (! ref($navmap)) { $r->print('<h1>'.&mt('A course-wide error occured.').'</h1>'. '<h3>'.$navmap.'</h3>'); + &clean_up(); return; } if (exists($env{'form.Excel'})) { @@ -765,6 +776,7 @@ sub BuildProblemStatisticsPage { &output_sequence_statistics($r); } } + &clean_up(); return; } @@ -1302,6 +1314,7 @@ sub Excel_output { &Apache::lonstatistics::section_and_enrollment_description('plaintext'), $format->{'h3'}); $cols_output += scalar(&Apache::lonstatistics::get_selected_sections()); + $cols_output += scalar(&Apache::lonstatistics::get_selected_groups()); # # Time restrictions my $time_string; @@ -1543,6 +1556,7 @@ sub get_statistics { # my $data = &Apache::loncoursedata::get_problem_statistics ([&Apache::lonstatistics::get_selected_sections()], + [&Apache::lonstatistics::get_selected_groups()], $Apache::lonstatistics::enrollment_status, $symb,$part,$courseid,$starttime,$endtime); $data->{'symb'} = $symb; @@ -1621,8 +1635,9 @@ sub compute_discrimination_factor { &Apache::loncoursedata::rank_students_by_scores_on_resources (\@Resources, [&Apache::lonstatistics::get_selected_sections()], + [&Apache::lonstatistics::get_selected_groups()], $Apache::lonstatistics::enrollment_status,undef, - $starttime,$endtime); + $starttime,$endtime, $symb); # # compute their percent scores on the problems in the sequence, my $number_to_grab = int(scalar(@{$ranking})/4); @@ -1632,7 +1647,7 @@ sub compute_discrimination_factor { my @TopSet = map { $_->[&Apache::loncoursedata::RNK_student()]; - } @{$ranking}[($num_students-$number_to_grab)..($num_students-1)]; + } @{$ranking}[-$number_to_grab..0]; if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') || ! @TopSet || (@TopSet == 1 && $TopSet[0] eq '')) { return 'nan'; @@ -1686,6 +1701,7 @@ sub compute_sequence_statistics { my ($smin,$smax,$sMean,$sSTD,$scount,$sMAX) = &Apache::loncoursedata::score_stats ([&Apache::lonstatistics::get_selected_sections()], + [&Apache::lonstatistics::get_selected_groups()], $Apache::lonstatistics::enrollment_status, \@Resources,$starttime,$endtime,undef); $SeqStat{$symb}->{'title'} = $seq->compTitle; @@ -1701,6 +1717,7 @@ sub compute_sequence_statistics { my ($cmin,$cmax,$cMean,$cSTD,$ccount)= &Apache::loncoursedata::count_stats ([&Apache::lonstatistics::get_selected_sections()], + [&Apache::lonstatistics::get_selected_groups()], $Apache::lonstatistics::enrollment_status, \@Resources,$starttime,$endtime,undef); my $K = $part_count;