--- loncom/interface/statistics/loncorrectproblemplot.pm 2005/03/01 22:25:59 1.15 +++ loncom/interface/statistics/loncorrectproblemplot.pm 2005/03/07 20:12:08 1.16 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncorrectproblemplot.pm,v 1.15 2005/03/01 22:25:59 matthew Exp $ +# $Id: loncorrectproblemplot.pm,v 1.16 2005/03/07 20:12:08 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -92,7 +92,7 @@ sub BuildCorrectProblemsPage { # Determine which problem symbs we are to sum over if (exists($ENV{'form.CreatePlot'})) { my @ProblemSymbs; - my $total_parts = 0; + my $total_weights = 0; my $title = ''; my @maps = &Apache::lonstatistics::get_selected_maps('Maps'); my ($navmap,@sequences) = @@ -104,23 +104,21 @@ sub BuildCorrectProblemsPage { } else { $title = 'Multiple Sequences'; } - my @resources = - &Apache::lonstathelpers::get_resources($navmap,$seq); - foreach my $res (@resources) { - foreach my $partid (@{$res->parts}) { - $total_parts++; - push(@ProblemSymbs,{symb=>$res->symb, - part=>$partid}); - } - } } } else { - $title = "All Problems"; - foreach my $seq (@sequences) { - my @resources = - &Apache::lonstathelpers::get_resources($navmap,$seq); - foreach my $res (@resources) { - $total_parts += scalar(@{$res->parts}); + $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); } } } @@ -131,12 +129,13 @@ sub BuildCorrectProblemsPage { &Apache::lonlocal::locallocaltime($starttime), &Apache::lonlocal::locallocaltime($endtime))); } + &Apache::loncoursedata::populate_weight_table(); my $score_data = &Apache::loncoursedata::get_student_scores (\@Apache::lonstatistics::SelectedSections, \@ProblemSymbs, $Apache::lonstatistics::enrollment_status,undef, $starttime,$endtime); - $r->print(&AnalyzeScoreData($score_data,$title,$total_parts)); + $r->print(&AnalyzeScoreData($score_data,$title,$total_weights)); } else { $r->print('

'.&mt('Make a sequence selection from the "Sequences and Folders" menu and hit "Create Plot" to begin').'

'); } @@ -158,7 +157,7 @@ return html with a plot of the data and ######################################################### ######################################################### sub AnalyzeScoreData { - my ($score_data,$title,$total_parts) = @_; + my ($score_data,$title,$maximum) = @_; # # Basic check first if (ref($score_data) ne 'ARRAY' || @$score_data < 1) { @@ -181,6 +180,9 @@ sub AnalyzeScoreData { my @Bins = &bin_data($score_data,$binsize,$lowest,$highest); my @Xdata; my @Ydata; my $max; my $Str = + '

'. + &mt('Problem weights do not reflect individual student settings.') + .'

'. ''."\n".''."\n"; my $sum = 0; while (my $bin = shift(@Bins)) { @@ -197,14 +199,13 @@ sub AnalyzeScoreData { $max = 5*(int($max/5)+1); $Str .= "
RangeCount

\n"; $title = &HTML::Entities::decode($title); - $Str = "\n

".&Apache::loncommon::DrawBarGraph($title.' N = '.$sum, - 'Correct Problems (max possible = '.$total_parts.')', - 'Number of students', - $max, - undef, # colors - \@Xdata, - \@Ydata). - "\n
\n".$Str; + $Str = "\n

". + &Apache::loncommon::DrawBarGraph($title.' ('.$sum.' students)', + 'Correct Problems (max possible = '.$maximum.')', + 'Number of students', + $max,undef, # colors + \@Xdata,\@Ydata). + "\n
\n".$Str; $Str .= '

'."\n"; return $Str; }