version 1.105, 2005/08/26 21:53:23
|
version 1.116, 2009/01/20 16:38:44
|
Line 60 use Apache::lonlocal;
|
Line 60 use Apache::lonlocal;
|
use Spreadsheet::WriteExcel; |
use Spreadsheet::WriteExcel; |
use Apache::lonstathelpers(); |
use Apache::lonstathelpers(); |
use Time::HiRes; |
use Time::HiRes; |
|
use LONCAPA; |
|
|
|
|
my @StatsArray; |
my @StatsArray; |
my %SeqStat; # keys are symbs, values are hash refs |
my %SeqStat; # keys are symbs, values are hash refs |
Line 575 sub parse_field_selection {
|
Line 577 sub parse_field_selection {
|
} |
} |
|
|
sub field_selection_input { |
sub field_selection_input { |
my $Str = '<select name="fieldselections" multiple size="5">'."\n"; |
my $Str = '<select name="fieldselections" multiple="multiple" size="5">'."\n"; |
$Str .= '<option value="all">all</option>'."\n"; |
$Str .= '<option value="all">all</option>'."\n"; |
foreach my $field (@Fields) { |
foreach my $field (@Fields) { |
next if ($field->{'selectable'} ne 'yes'); |
next if ($field->{'selectable'} ne 'yes'); |
Line 608 sub CreateInterface {
|
Line 610 sub CreateInterface {
|
&parse_field_selection(); |
&parse_field_selection(); |
# |
# |
my $Str = ''; |
my $Str = ''; |
$Str .= &Apache::lonhtmlcommon::breadcrumbs |
$Str .= &Apache::lonhtmlcommon::breadcrumbs('Overall Problem Statistics', |
(undef,'Overall Problem Statistics','Statistics_Overall_Key'); |
'Statistics_Overall_Key'); |
$Str .= '<table cellspacing="5">'."\n"; |
$Str .= '<p>'; |
$Str .= '<tr>'; |
$Str .= &Apache::loncommon::start_data_table(); |
$Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>'; |
$Str .= &Apache::loncommon::start_data_table_header_row(); |
$Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>'; |
$Str .= '<th>'.&mt('Sections').'</th>'; |
$Str .= '<td align="center"><b>'.&mt('Sequences and Folders').'</b></td>'; |
$Str .= '<th>'.&mt('Groups').'</th>'; |
$Str .= '<td align="center"><b>'.&mt('Statistics').'</b></td>'; |
$Str .= '<th>'.&mt('Access Status').'</th>'; |
$Str .= '<td rowspan="2">'. |
$Str .= '<th>'.&mt('Sequences and Folders').'</th>'; |
&Apache::lonstathelpers::limit_by_time_form().'</td>'; |
$Str .= '<th>'.&mt('Statistics').'</th>'; |
$Str .= '</tr>'."\n"; |
$Str .= '<th>'.&mt('Plot Graph').'</th>'; |
|
$Str .= '<th>'.&mt('Time Period').'</th>'; |
|
$Str .= &Apache::loncommon::end_data_table_header_row(); |
# |
# |
$Str .= '<tr><td align="center">'."\n"; |
$Str .= &Apache::loncommon::start_data_table_row(); |
|
$Str .= '<td align="center" valign="top">'."\n"; |
$Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); |
$Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); |
$Str .= '</td><td align="center">'; |
$Str .= '</td><td align="center" valign="top">'; |
|
$Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5); |
|
$Str .= '</td><td align="center" valign="top">'; |
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= '</td><td align="center">'; |
$Str .= '</td><td align="center" valign="top">'; |
# |
# |
$Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5); |
$Str .= &Apache::lonstatistics::map_select('Maps','multiple,all',5); |
$Str .= '</td><td>'.&field_selection_input(); |
$Str .= '</td><td align="center" valign="top">'; |
$Str .= '</td></tr>'."\n"; |
$Str .= &field_selection_input(); |
$Str .= '</table>'."\n"; |
$Str .= '</td><td align="center" valign="top">'; |
# |
$Str .= &plot_dropdown(); |
$Str .= '<p>'.&mt('Status: [_1]', |
$Str .= '</td>'."\n"; |
'<input type="text" '. |
$Str .= '</td><td align="center" valign="top">'; |
'name="stats_status" size="60" value="" />' |
$Str .= &Apache::lonstathelpers::limit_by_time_form(); |
). |
$Str .= '</td>'."\n"; |
'</nobr></p>'; |
$Str .= &Apache::loncommon::end_data_table_row(); |
|
$Str .= &Apache::loncommon::end_data_table(); |
|
# |
|
$Str .= '<p><span class="LC_nobreak">' |
|
.&mt('Status: [_1]', |
|
'<input type="text" name="stats_status"' |
|
.' size="60" value="" readonly="readonly" />') |
|
.'</span></p>'; |
# |
# |
|
$Str .= '</p>'; |
$Str .= '<input type="submit" name="GenerateStatistics" value="'. |
$Str .= '<input type="submit" name="GenerateStatistics" value="'. |
&mt('Generate Statistics').'" />'; |
&mt('Generate Statistics').'" />'; |
$Str .= ' 'x5; |
$Str .= (' 'x10); |
$Str .= 'Plot '.&plot_dropdown().(' 'x10); |
|
# |
# |
return $Str; |
return $Str; |
} |
} |
Line 674 sub BuildProblemStatisticsPage {
|
Line 688 sub BuildProblemStatisticsPage {
|
my %Saveable_Parameters = ('Status' => 'scalar', |
my %Saveable_Parameters = ('Status' => 'scalar', |
'statsoutputmode' => 'scalar', |
'statsoutputmode' => 'scalar', |
'Section' => 'array', |
'Section' => 'array', |
|
'Groups' => 'array', |
'StudentData' => 'array', |
'StudentData' => 'array', |
'Maps' => 'array', |
'Maps' => 'array', |
'fieldselections'=> 'array'); |
'fieldselections'=> 'array'); |
Line 708 sub BuildProblemStatisticsPage {
|
Line 723 sub BuildProblemStatisticsPage {
|
'</h3><p>'. |
'</h3><p>'. |
&mt('It may take some time to update the student data '. |
&mt('It may take some time to update the student data '. |
'for the first analysis. Future analysis this session '. |
'for the first analysis. Future analysis this session '. |
' will not have this delay.'). |
'will not have this delay.'). |
'</p>'); |
'</p>'); |
&clean_up(); |
&clean_up(); |
return; |
return; |
Line 722 sub BuildProblemStatisticsPage {
|
Line 737 sub BuildProblemStatisticsPage {
|
($navmap,@sequences) = |
($navmap,@sequences) = |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
if (! ref($navmap)) { |
if (! ref($navmap)) { |
$r->print('<h1>'.&mt('A course-wide error occured.').'</h1>'. |
$r->print('<div class="LC_error">'.&mt('A course-wide error occurred.').'</div>'. |
'<h3>'.$navmap.'</h3>'); |
'<h3>'.$navmap.'</h3>'); |
&clean_up(); |
&clean_up(); |
return; |
return; |
Line 1310 sub Excel_output {
|
Line 1325 sub Excel_output {
|
&Apache::lonstatistics::section_and_enrollment_description('plaintext'), |
&Apache::lonstatistics::section_and_enrollment_description('plaintext'), |
$format->{'h3'}); |
$format->{'h3'}); |
$cols_output += scalar(&Apache::lonstatistics::get_selected_sections()); |
$cols_output += scalar(&Apache::lonstatistics::get_selected_sections()); |
|
$cols_output += scalar(&Apache::lonstatistics::get_selected_groups()); |
# |
# |
# Time restrictions |
# Time restrictions |
my $time_string; |
my $time_string; |
Line 1551 sub get_statistics {
|
Line 1567 sub get_statistics {
|
# |
# |
my $data = &Apache::loncoursedata::get_problem_statistics |
my $data = &Apache::loncoursedata::get_problem_statistics |
([&Apache::lonstatistics::get_selected_sections()], |
([&Apache::lonstatistics::get_selected_sections()], |
|
[&Apache::lonstatistics::get_selected_groups()], |
$Apache::lonstatistics::enrollment_status, |
$Apache::lonstatistics::enrollment_status, |
$symb,$part,$courseid,$starttime,$endtime); |
$symb,$part,$courseid,$starttime,$endtime); |
$data->{'symb'} = $symb; |
$data->{'symb'} = $symb; |
Line 1559 sub get_statistics {
|
Line 1576 sub get_statistics {
|
$data->{'container'} = $sequence->compTitle; |
$data->{'container'} = $sequence->compTitle; |
$data->{'title'} = $resource->compTitle; |
$data->{'title'} = $resource->compTitle; |
$data->{'title.link'} = $resource->src.'?symb='. |
$data->{'title.link'} = $resource->src.'?symb='. |
&Apache::lonnet::escape($resource->symb); |
&escape($resource->symb); |
# |
# |
if ($SelectedFields{'deg_of_disc'}) { |
if ($SelectedFields{'deg_of_disc'}) { |
$data->{'deg_of_disc'} = |
$data->{'deg_of_disc'} = |
Line 1577 sub get_statistics {
|
Line 1594 sub get_statistics {
|
$data->{'urlres'}=$urlres; |
$data->{'urlres'}=$urlres; |
my %storestats = |
my %storestats = |
&LONCAPA::lonmetadata::dynamic_metadata_storage($data); |
&LONCAPA::lonmetadata::dynamic_metadata_storage($data); |
my ($dom,$user) = $urlres=~/^(\w+)\/(\w+)/; |
my ($dom,$user) = ($urlres=~m{^($LONCAPA::domain_re)/($LONCAPA::username_re)}); |
&Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user); |
&Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user); |
} |
} |
# |
# |
Line 1585 sub get_statistics {
|
Line 1602 sub get_statistics {
|
($data->{'num_solved'}+0.1); |
($data->{'num_solved'}+0.1); |
# |
# |
# Get the due date for research purposes (commented out most of the time) |
# Get the due date for research purposes (commented out most of the time) |
# $data->{'duedate'} = |
# my $duedate = &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb);; |
# &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb); |
# my $opendate = &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb); |
# $data->{'opendate'} = |
# my $maxtries = &Apache::lonnet::EXT('resource.'.$part.'.maxtries',$symb); |
# &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb); |
# my $hinttries = &Apache::lonnet::EXT('resource.'.$part.'.hinttries',$symb); |
# $data->{'maxtries'} = |
my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',$symb); |
# &Apache::lonnet::EXT('resource.'.$part.'.maxtries',$symb); |
$data->{'weight'} = $weight; |
# $data->{'hinttries'} = |
# $data->{'duedate'} = $duedate; |
# &Apache::lonnet::EXT('resource.'.$part.'.hinttries',$symb); |
# $data->{'opendate'} = $opendate; |
$data->{'weight'} = |
# $data->{'maxtries'} = $maxtries; |
&Apache::lonnet::EXT('resource.'.$part.'.weight',$symb); |
# $data->{'hinttries'} = $hinttries; |
# $data->{'resptypes'} = join(',',@{$resource->{'partdata'}->{$part}->{'ResponseTypes'}}); |
# $data->{'resptypes'} = join(',',@{$resource->{'partdata'}->{$part}->{'ResponseTypes'}}); |
return $data; |
return $data; |
} |
} |
Line 1629 sub compute_discrimination_factor {
|
Line 1646 sub compute_discrimination_factor {
|
&Apache::loncoursedata::rank_students_by_scores_on_resources |
&Apache::loncoursedata::rank_students_by_scores_on_resources |
(\@Resources, |
(\@Resources, |
[&Apache::lonstatistics::get_selected_sections()], |
[&Apache::lonstatistics::get_selected_sections()], |
|
[&Apache::lonstatistics::get_selected_groups()], |
$Apache::lonstatistics::enrollment_status,undef, |
$Apache::lonstatistics::enrollment_status,undef, |
$starttime,$endtime); |
$starttime,$endtime, $symb); |
# |
# |
# compute their percent scores on the problems in the sequence, |
# compute their percent scores on the problems in the sequence, |
my $number_to_grab = int(scalar(@{$ranking})/4); |
my $number_to_grab = int(scalar(@{$ranking})/4); |
Line 1640 sub compute_discrimination_factor {
|
Line 1658 sub compute_discrimination_factor {
|
my @TopSet = |
my @TopSet = |
map { |
map { |
$_->[&Apache::loncoursedata::RNK_student()]; |
$_->[&Apache::loncoursedata::RNK_student()]; |
} @{$ranking}[($num_students-$number_to_grab)..($num_students-1)]; |
} @{$ranking}[-$number_to_grab..0]; |
if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') || |
if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') || |
! @TopSet || (@TopSet == 1 && $TopSet[0] eq '')) { |
! @TopSet || (@TopSet == 1 && $TopSet[0] eq '')) { |
return 'nan'; |
return 'nan'; |
Line 1694 sub compute_sequence_statistics {
|
Line 1712 sub compute_sequence_statistics {
|
my ($smin,$smax,$sMean,$sSTD,$scount,$sMAX) = |
my ($smin,$smax,$sMean,$sSTD,$scount,$sMAX) = |
&Apache::loncoursedata::score_stats |
&Apache::loncoursedata::score_stats |
([&Apache::lonstatistics::get_selected_sections()], |
([&Apache::lonstatistics::get_selected_sections()], |
|
[&Apache::lonstatistics::get_selected_groups()], |
$Apache::lonstatistics::enrollment_status, |
$Apache::lonstatistics::enrollment_status, |
\@Resources,$starttime,$endtime,undef); |
\@Resources,$starttime,$endtime,undef); |
$SeqStat{$symb}->{'title'} = $seq->compTitle; |
$SeqStat{$symb}->{'title'} = $seq->compTitle; |
Line 1709 sub compute_sequence_statistics {
|
Line 1728 sub compute_sequence_statistics {
|
my ($cmin,$cmax,$cMean,$cSTD,$ccount)= |
my ($cmin,$cmax,$cMean,$cSTD,$ccount)= |
&Apache::loncoursedata::count_stats |
&Apache::loncoursedata::count_stats |
([&Apache::lonstatistics::get_selected_sections()], |
([&Apache::lonstatistics::get_selected_sections()], |
|
[&Apache::lonstatistics::get_selected_groups()], |
$Apache::lonstatistics::enrollment_status, |
$Apache::lonstatistics::enrollment_status, |
\@Resources,$starttime,$endtime,undef); |
\@Resources,$starttime,$endtime,undef); |
my $K = $part_count; |
my $K = $part_count; |