--- loncom/interface/statistics/loncorrectproblemplot.pm 2004/02/20 16:38:49 1.7 +++ loncom/interface/statistics/loncorrectproblemplot.pm 2005/04/07 06:56:24 1.18 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncorrectproblemplot.pm,v 1.7 2004/02/20 16:38:49 matthew Exp $ +# $Id: loncorrectproblemplot.pm,v 1.18 2005/04/07 06:56:24 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,7 +28,7 @@ package Apache::loncorrectproblemplot; use strict; -use Apache::lonnet(); +use Apache::lonnet; use Apache::loncommon(); use Apache::lonhtmlcommon(); use Apache::loncoursedata(); @@ -39,10 +39,6 @@ use Apache::lonlocal; my @SubmitButtons = ( { name => 'CreatePlot', text => 'Create Plot' }, - { name => 'ClearCache', - text => 'Clear Caches' }, - { name => 'updatecaches', - text => 'Update Student Data' }, ); ######################################################### @@ -81,44 +77,70 @@ sub BuildCorrectProblemsPage { ''); } # - &Apache::loncoursedata::clear_internal_caches(); - if (exists($ENV{'form.ClearCache'}) || - exists($ENV{'form.updatecaches'}) || - (exists($ENV{'form.firstanalysis'}) && - $ENV{'form.firstanalysis'} ne 'no')) { - &Apache::lonstatistics::Gather_Full_Student_Data($r); - } - if (! exists($ENV{'form.firstanalysis'})) { - $r->print(''); - } else { - $r->print(''); - } + my @CacheButtonHTML = + &Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status'); foreach my $button (@SubmitButtons) { $r->print('{'text'}).'" />'); $r->print(' 'x5); } + foreach my $html (@CacheButtonHTML) { + $r->print($html.(' 'x5)); + } $r->rflush(); # # Determine which problem symbs we are to sum over - if (exists($ENV{'form.CreatePlot'})) { + if (exists($env{'form.CreatePlot'})) { my @ProblemSymbs; - if ($Apache::lonstatistics::SelectedMaps[0] ne 'all') { - foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()){ - foreach my $res (@{$seq->{'contents'}}) { - next if ($res->{'type'} ne 'assessment'); - foreach my $part (@{$res->{'parts'}}) { - push(@ProblemSymbs,{symb=>$res->{'symb'}, - part=>$part}); - } + my $total_weights = 0; + my $title = ''; + my @maps = &Apache::lonstatistics::get_selected_maps('Maps'); + my ($navmap,@sequences) = + &Apache::lonstatistics::selected_sequences_with_assessments(); + if ($maps[0] ne 'all') { + foreach my $seq (@sequences) { + if ($title eq '') { + $title = $seq->compTitle; + } else { + $title = 'Multiple Sequences'; + } + } + } else { + $title = 'All Problems'; + } + foreach my $seq (@sequences) { + my @resources = + &Apache::lonstathelpers::get_resources($navmap,$seq); + foreach my $res (@resources) { + foreach my $partid (@{$res->parts}) { + push(@ProblemSymbs,{symb=>$res->symb, + part=>$partid}); + $total_weights += + &Apache::lonnet::EXT('resource.'.$partid.'.weight', + $res->symb, + undef,undef,undef); } } } + $r->print('
Range | Count |
---|
Range | Count |
---|
".
+ &Apache::loncommon::DrawBarGraph($title.' ('.$sum.' students)',
+ 'Correct Problems (max possible = '.$maximum.')',
+ 'Number of students',
+ $max,undef, # colors
+ \@Xdata,\@Ydata).
+ "\n
\n".$Str;
+ $Str .= '
'; + # $Str .= '
'.&mt('Sections').' | '; $Str .= ''.&mt('Enrollment Status').' | '; $Str .= ''.&mt('Sequences and Folders').' | '; + $Str .= ''. + &Apache::lonstathelpers::limit_by_time_form().' | '; $Str .= '
'."\n"; $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= ' | '; @@ -273,20 +308,17 @@ sub CreateInterface { $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); $Str .= ''."\n"; # - my $only_seq_with_assessments = sub { - my $s=shift; - if ($s->{'num_assess'} < 1) { - return 0; - } else { - return 1; - } - }; - $Str .= &Apache::lonstatistics::MapSelect('Maps','multiple,all',5, - $only_seq_with_assessments); - $Str .= ' | '."\n"; - ## + $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5); + $Str .= ' | '; + # $Str .= '