--- loncom/interface/statistics/loncorrectproblemplot.pm 2004/03/01 16:39:19 1.8 +++ loncom/interface/statistics/loncorrectproblemplot.pm 2012/05/07 10:12:42 1.28 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncorrectproblemplot.pm,v 1.8 2004/03/01 16:39:19 matthew Exp $ +# $Id: loncorrectproblemplot.pm,v 1.28 2012/05/07 10:12:42 goltermann Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,9 +28,10 @@ package Apache::loncorrectproblemplot; use strict; -use Apache::lonnet(); +use Apache::lonnet; use Apache::loncommon(); use Apache::lonhtmlcommon(); +use Apache::lonquickgrades(); use Apache::loncoursedata(); use Apache::lonstatistics; use Apache::lonstathelpers; @@ -39,10 +40,6 @@ use Apache::lonlocal; my @SubmitButtons = ( { name => 'CreatePlot', text => 'Create Plot' }, - { name => 'ClearCache', - text => 'Clear Caches' }, - { name => 'updatecaches', - text => 'Update Student Data' }, ); ######################################################### @@ -63,13 +60,17 @@ sub BuildCorrectProblemsPage { my ($r,$c)=@_; # my %Saveable_Parameters = ('Status' => 'scalar', - 'Section' => 'array'); + 'Section' => 'array', + 'Groups' => 'array'); &Apache::loncommon::store_course_settings('correct_problems_plot', \%Saveable_Parameters); &Apache::loncommon::restore_course_settings('correct_problems_plot', \%Saveable_Parameters); # &Apache::lonstatistics::PrepareClasslist(); + + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Correct Problems Plot')); + &Apache::lonquickgrades::startGradeScreen($r,'statistics'); # $r->print(&CreateInterface()); # @@ -77,48 +78,75 @@ sub BuildCorrectProblemsPage { # if (@Students < 1) { $r->print('
'. + &Apache::lonstatistics::section_and_enrollment_description(). + '
'); + my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); + if (defined($starttime) || defined($endtime)) { + # Inform the user what the time limits on the data are. + $r->print(&mt('Statistics on submissions from [_1] to [_2]', + &Apache::lonlocal::locallocaltime($starttime), + &Apache::lonlocal::locallocaltime($endtime))); + } + &Apache::loncoursedata::populate_weight_table(); my $score_data = &Apache::loncoursedata::get_student_scores - (\@Apache::lonstatistics::SelectedSections, + ([&Apache::lonstatistics::get_selected_sections()], + [&Apache::lonstatistics::get_selected_groups()], \@ProblemSymbs, - $Apache::lonstatistics::enrollment_status); - $r->print(&AnalyzeScoreData($score_data)); + $Apache::lonstatistics::enrollment_status,undef, + $starttime,$endtime); + $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').'
'); } return; } @@ -138,11 +166,11 @@ return html with a plot of the data and ######################################################### ######################################################### sub AnalyzeScoreData { - my ($score_data) = @_; + my ($score_data,$title,$maximum) = @_; # # Basic check first - if (@$score_data < 1) { - return ''.&mt('There is no data to plot').'
'; } # # Determine which bins to use @@ -160,28 +188,39 @@ sub AnalyzeScoreData { # Get the data into the bins (destroying $score_data in the process) my @Bins = &bin_data($score_data,$binsize,$lowest,$highest); my @Xdata; my @Ydata; my $max; - my $Str = 'Range | Count | '.&mt('Range').' | '.&mt('Count').' | '. + &Apache::loncommon::end_data_table_header_row(); + my $sum = 0; while (my $bin = shift(@Bins)) { push (@Xdata,$bin->{'start'}); push (@Ydata,$bin->{'count'}); + $sum += $bin->{'count'}; if ($bin->{'count'} > $max) { $max = $bin->{'count'}; } - $Str.= '
---|---|
'.$bin->{'start'}.' - '.$bin->{'end'}.' | '. - ''.$bin->{'count'}.' | '.$bin->{'start'}.' - '.$bin->{'end'}.' | '. + ''.$bin->{'count'}.' | '. + &Apache::loncommon::end_data_table_row().'
".
+ &Apache::loncommon::DrawBarGraph($title.' ('.$sum.' students)',
+ 'Correct Problems (max possible = '.$maximum.')',
+ 'Number of students',
+ $max,undef, # colors
+ \@Xdata,\@Ydata).
+ "\n
\n".$Str;
+ $Str .= '
'.&mt('Sections').' | '; - $Str .= ''.&mt('Enrollment Status').' | '; - $Str .= ''.&mt('Sequences and Folders').' | '; - $Str .= '|||||||||||
'."\n";
+ $Str .= ' '; + # + $Str .= &Apache::loncommon::start_data_table(); + $Str .= &Apache::loncommon::start_data_table_header_row(); + $Str .= ' | '.&mt('Sections').' | '; + $Str .= ''.&mt('Groups').' | '; + $Str .= ''.&mt('Access Status').' | '; + $Str .= ''.&mt('Sequences and Folders').' | '; + $Str .= ''.&mt('Time Period').' | '; + $Str .= &Apache::loncommon::end_data_table_header_row(); + # + $Str .= &Apache::loncommon::start_data_table_row(); + $Str .= ''."\n"; $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= ' | '; # - $Str .= ''; + $Str .= ' | '."\n"; + $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5); + $Str .= ' | '; + $Str .= ''; $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); - $Str .= ' | '."\n"; + $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 .= ' | '."\n"; + $Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5); + $Str .= ' | '; + # + $Str .= ''."\n"; + $Str .= &Apache::lonstathelpers::limit_by_time_form(); + $Str .= ' | '; + # + $Str .= &Apache::loncommon::end_data_table_row(); + $Str .= &Apache::loncommon::end_data_table(); ## - $Str .= '
---|