--- loncom/interface/statistics/loncorrectproblemplot.pm 2004/06/04 21:42:18 1.11 +++ loncom/interface/statistics/loncorrectproblemplot.pm 2005/03/01 22:25:59 1.15 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncorrectproblemplot.pm,v 1.11 2004/06/04 21:42:18 matthew Exp $ +# $Id: loncorrectproblemplot.pm,v 1.15 2005/03/01 22:25:59 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -94,22 +94,35 @@ sub BuildCorrectProblemsPage { my @ProblemSymbs; my $total_parts = 0; my $title = ''; - if ($Apache::lonstatistics::SelectedMaps[0] ne 'all') { - foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()){ + 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->{'title'}; + $title = $seq->compTitle; } else { $title = 'Multiple Sequences'; } - foreach my $res (@{$seq->{'contents'}}) { - next if ($res->{'type'} ne 'assessment'); - foreach my $part (@{$res->{'parts'}}) { + 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=>$part}); + 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}); + } + } } my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); if (defined($starttime) || defined($endtime)) { @@ -148,15 +161,14 @@ sub AnalyzeScoreData { my ($score_data,$title,$total_parts) = @_; # # Basic check first - if (@$score_data < 1) { - return '
".&Apache::loncommon::DrawBarGraph($title.' N = '.$sum, - 'Num Correct Problems (max:'.$total_parts.')', + 'Correct Problems (max possible = '.$total_parts.')', 'Number of students', $max, undef, # colors @@ -272,8 +284,7 @@ sub CreateInterface { ## ## Environment variable initialization my $Str; - $Str .= &Apache::lonhtmlcommon::breadcrumbs - (undef,'Correct Problems Plot'); + $Str .= &Apache::lonhtmlcommon::breadcrumbs(undef,'Correct Problems Plot'); $Str .= '
'; # $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 .= &Apache::lonstatistics::map_select('Maps','multiple,all',5); $Str .= ' | '; # $Str .= ''."\n";