version 1.12, 2004/10/06 14:21:57
|
version 1.19, 2006/05/01 19:29:13
|
Line 28
|
Line 28
|
package Apache::loncorrectproblemplot; |
package Apache::loncorrectproblemplot; |
|
|
use strict; |
use strict; |
use Apache::lonnet(); |
use Apache::lonnet; |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::loncoursedata(); |
use Apache::loncoursedata(); |
Line 90 sub BuildCorrectProblemsPage {
|
Line 90 sub BuildCorrectProblemsPage {
|
$r->rflush(); |
$r->rflush(); |
# |
# |
# Determine which problem symbs we are to sum over |
# Determine which problem symbs we are to sum over |
if (exists($ENV{'form.CreatePlot'})) { |
if (exists($env{'form.CreatePlot'})) { |
my @ProblemSymbs; |
my @ProblemSymbs; |
my $total_parts = 0; |
my $total_weights = 0; |
my $title = ''; |
my $title = ''; |
if ($Apache::lonstatistics::SelectedMaps[0] ne 'all') { |
my @maps = &Apache::lonstatistics::get_selected_maps('Maps'); |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()){ |
my ($navmap,@sequences) = |
|
&Apache::lonstatistics::selected_sequences_with_assessments(); |
|
if ($maps[0] ne 'all') { |
|
foreach my $seq (@sequences) { |
if ($title eq '') { |
if ($title eq '') { |
$title = $seq->{'title'}; |
$title = $seq->compTitle; |
} else { |
} else { |
$title = 'Multiple Sequences'; |
$title = 'Multiple Sequences'; |
} |
} |
foreach my $res (@{$seq->{'contents'}}) { |
} |
next if ($res->{'type'} ne 'assessment'); |
} else { |
foreach my $part (@{$res->{'parts'}}) { |
$title = 'All Problems'; |
$total_parts++; |
} |
push(@ProblemSymbs,{symb=>$res->{'symb'}, |
foreach my $seq (@sequences) { |
part=>$part}); |
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('<h4>'. |
|
&Apache::lonstatistics::section_and_enrollment_description(). |
|
'</h4>'); |
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); |
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); |
if (defined($starttime) || defined($endtime)) { |
if (defined($starttime) || defined($endtime)) { |
# Inform the user what the time limits on the data are. |
# Inform the user what the time limits on the data are. |
Line 118 sub BuildCorrectProblemsPage {
|
Line 132 sub BuildCorrectProblemsPage {
|
&Apache::lonlocal::locallocaltime($starttime), |
&Apache::lonlocal::locallocaltime($starttime), |
&Apache::lonlocal::locallocaltime($endtime))); |
&Apache::lonlocal::locallocaltime($endtime))); |
} |
} |
|
&Apache::loncoursedata::populate_weight_table(); |
my $score_data = &Apache::loncoursedata::get_student_scores |
my $score_data = &Apache::loncoursedata::get_student_scores |
(\@Apache::lonstatistics::SelectedSections, |
([&Apache::lonstatistics::get_selected_sections()], |
\@ProblemSymbs, |
\@ProblemSymbs, |
$Apache::lonstatistics::enrollment_status,undef, |
$Apache::lonstatistics::enrollment_status,undef, |
$starttime,$endtime); |
$starttime,$endtime); |
$r->print(&AnalyzeScoreData($score_data,$title,$total_parts)); |
$r->print(&AnalyzeScoreData($score_data,$title,$total_weights)); |
} else { |
} else { |
$r->print('<h3>'.&mt('Make a sequence selection from the "Sequences and Folders" menu and hit "Create Plot" to begin').'</h3>'); |
$r->print('<h3>'.&mt('Make a sequence selection from the "Sequences and Folders" menu and hit "Create Plot" to begin').'</h3>'); |
} |
} |
Line 145 return html with a plot of the data and
|
Line 160 return html with a plot of the data and
|
######################################################### |
######################################################### |
######################################################### |
######################################################### |
sub AnalyzeScoreData { |
sub AnalyzeScoreData { |
my ($score_data,$title,$total_parts) = @_; |
my ($score_data,$title,$maximum) = @_; |
# |
# |
# Basic check first |
# Basic check first |
if (ref($score_data) ne 'ARRAY' || @$score_data < 1) { |
if (ref($score_data) ne 'ARRAY' || @$score_data < 1) { |
Line 156 sub AnalyzeScoreData {
|
Line 171 sub AnalyzeScoreData {
|
my $lowest = $score_data->[0]->[0]; |
my $lowest = $score_data->[0]->[0]; |
$lowest = 0; |
$lowest = 0; |
my $highest = $score_data->[-1]->[0]; |
my $highest = $score_data->[-1]->[0]; |
&Apache::lonnet::logthis('highest = '.$highest); |
|
my $binsize = 1; |
my $binsize = 1; |
if ($highest > 50) { $binsize = 2; } |
if ($highest > 50) { $binsize = 2; } |
if ($highest > 100) { $binsize = 5; } |
if ($highest > 100) { $binsize = 5; } |
Line 169 sub AnalyzeScoreData {
|
Line 183 sub AnalyzeScoreData {
|
my @Bins = &bin_data($score_data,$binsize,$lowest,$highest); |
my @Bins = &bin_data($score_data,$binsize,$lowest,$highest); |
my @Xdata; my @Ydata; my $max; |
my @Xdata; my @Ydata; my $max; |
my $Str = |
my $Str = |
|
'<p>'. |
|
&mt('Problem weights do not reflect individual student settings.') |
|
.'</p>'. |
'<table border="1">'."\n".'<tr><th>Range</th><th>Count</th></tr>'."\n"; |
'<table border="1">'."\n".'<tr><th>Range</th><th>Count</th></tr>'."\n"; |
my $sum = 0; |
my $sum = 0; |
while (my $bin = shift(@Bins)) { |
while (my $bin = shift(@Bins)) { |
Line 185 sub AnalyzeScoreData {
|
Line 202 sub AnalyzeScoreData {
|
$max = 5*(int($max/5)+1); |
$max = 5*(int($max/5)+1); |
$Str .= "</table><br />\n"; |
$Str .= "</table><br />\n"; |
$title = &HTML::Entities::decode($title); |
$title = &HTML::Entities::decode($title); |
$Str = "\n<p>".&Apache::loncommon::DrawBarGraph($title.' N = '.$sum, |
$Str = "\n<p>". |
'Num Correct Problems (max:'.$total_parts.')', |
&Apache::loncommon::DrawBarGraph($title.' ('.$sum.' students)', |
'Number of students', |
'Correct Problems (max possible = '.$maximum.')', |
$max, |
'Number of students', |
undef, # colors |
$max,undef, # colors |
\@Xdata, |
\@Xdata,\@Ydata). |
\@Ydata). |
"\n<br />\n".$Str; |
"\n<br />\n".$Str; |
|
$Str .= '</p>'."\n"; |
$Str .= '</p>'."\n"; |
return $Str; |
return $Str; |
} |
} |
Line 272 sub CreateInterface {
|
Line 288 sub CreateInterface {
|
## |
## |
## Environment variable initialization |
## Environment variable initialization |
my $Str; |
my $Str; |
$Str .= &Apache::lonhtmlcommon::breadcrumbs |
$Str .= &Apache::lonhtmlcommon::breadcrumbs('Correct Problems Plot'); |
(undef,'Correct Problems Plot'); |
|
$Str .= '<p>'; |
$Str .= '<p>'; |
# |
# |
$Str .= '<table cellspacing="5">'."\n"; |
$Str .= '<table cellspacing="5">'."\n"; |
Line 293 sub CreateInterface {
|
Line 308 sub CreateInterface {
|
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= '</td><td>'."\n"; |
$Str .= '</td><td>'."\n"; |
# |
# |
my $only_seq_with_assessments = sub { |
$Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5); |
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 .= '</td>'; |
$Str .= '</td>'; |
# |
# |
$Str .= '</tr>'."\n"; |
$Str .= '</tr>'."\n"; |