version 1.88, 2004/06/16 14:21:16
|
version 1.98, 2005/03/03 18:56:26
|
Line 231 my @Fields = (
|
Line 231 my @Fields = (
|
selectable => 'yes', |
selectable => 'yes', |
defaultselected => 'yes', |
defaultselected => 'yes', |
}, |
}, |
|
{ name => 'tries_per_correct', |
|
title => 'tries/correct', |
|
align => 'right', |
|
color => '#FFDDDD', |
|
format => '%4.1f', |
|
sortable => 'yes', |
|
graphable => 'yes', |
|
long_title => 'Tries per Correct Answer', |
|
selectable => 'yes', |
|
defaultselected => 'yes', |
|
}, |
{ name => 'num_wrong', |
{ name => 'num_wrong', |
title => '#Wrng', |
title => '#Wrng', |
align => 'right', |
align => 'right', |
Line 238 my @Fields = (
|
Line 249 my @Fields = (
|
format => '%4.1f', |
format => '%4.1f', |
sortable => 'yes', |
sortable => 'yes', |
graphable => 'yes', |
graphable => 'yes', |
|
long_title => 'Number of students whose final answer is wrong', |
|
selectable => 'yes', |
|
defaultselected => 'yes', |
|
}, |
|
{ name => 'per_wrong', |
|
title => '%Wrng', |
|
align => 'right', |
|
color => '#FFDDDD', |
|
format => '%4.1f', |
|
sortable => 'yes', |
|
graphable => 'yes', |
long_title => 'Percent of students whose final answer is wrong', |
long_title => 'Percent of students whose final answer is wrong', |
selectable => 'yes', |
selectable => 'yes', |
defaultselected => 'yes', |
defaultselected => 'yes', |
Line 263 my @Fields = (
|
Line 285 my @Fields = (
|
graphable => 'yes', |
graphable => 'yes', |
long_title => 'Degree of Discrimination', |
long_title => 'Degree of Discrimination', |
selectable => 'yes', |
selectable => 'yes', |
defaultselected => 'no', |
defaultselected => 'yes', |
}, |
}, |
## duedate included for research purposes. Commented out most of the time. |
## duedate included for research purposes. Commented out most of the time. |
# { name => 'duedate', |
# { name => 'duedate', |
Line 309 my @Fields = (
|
Line 331 my @Fields = (
|
# selectable => 'no', |
# selectable => 'no', |
# defaultselected => 'yes', |
# defaultselected => 'yes', |
# }, |
# }, |
|
## maxtries included for research purposes. Commented out most of the time. |
|
# { name => 'maxtries', |
|
# title => 'Maxtries', |
|
# align => 'left', |
|
# color => '#FFFFFF', |
|
# sortable => 'no', |
|
# graphable => 'no', |
|
# long_title => 'Maximum number of tries', |
|
# selectable => 'no', |
|
# defaultselected => 'yes', |
|
# }, |
|
## hinttries included for research purposes. Commented out most of the time. |
|
# { name => 'hinttries', |
|
# title => 'hinttries', |
|
# align => 'left', |
|
# color => '#FFFFFF', |
|
# sortable => 'no', |
|
# graphable => 'no', |
|
# long_title => 'Number of tries before a hint appears', |
|
# selectable => 'no', |
|
# defaultselected => 'yes', |
|
# }, |
|
# |
|
## problem weight for instructor |
|
{ name => 'weight', |
|
title => 'weight', |
|
align => 'right', |
|
color => '#FFFFFF', |
|
sortable => 'no', |
|
graphable => 'no', |
|
long_title => 'Problem weight (for instructor)', |
|
selectable => 'no', |
|
defaultselected => 'yes', |
|
}, |
); |
); |
|
|
my @SeqFields = ( |
my @SeqFields = ( |
Line 570 sub CreateInterface {
|
Line 626 sub CreateInterface {
|
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); |
$Str .= '</td><td align="center">'; |
$Str .= '</td><td align="center">'; |
# |
# |
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><td>'.&field_selection_input(); |
$Str .= '</td><td>'.&field_selection_input(); |
$Str .= '</td></tr>'."\n"; |
$Str .= '</td></tr>'."\n"; |
$Str .= '</table>'."\n"; |
$Str .= '</table>'."\n"; |
Line 611 Main interface to problem statistics.
|
Line 658 Main interface to problem statistics.
|
|
|
############################################### |
############################################### |
############################################### |
############################################### |
|
my $navmap; |
|
my @sequences; |
|
|
sub BuildProblemStatisticsPage { |
sub BuildProblemStatisticsPage { |
my ($r,$c)=@_; |
my ($r,$c)=@_; |
|
undef($navmap); |
|
undef(@sequences); |
# |
# |
my %Saveable_Parameters = ('Status' => 'scalar', |
my %Saveable_Parameters = ('Status' => 'scalar', |
'statsoutputmode' => 'scalar', |
'statsoutputmode' => 'scalar', |
Line 668 sub BuildProblemStatisticsPage {
|
Line 720 sub BuildProblemStatisticsPage {
|
&mt('Produce Excel Output').'" />'.' 'x5); |
&mt('Produce Excel Output').'" />'.' 'x5); |
$r->rflush(); |
$r->rflush(); |
my $count = 0; |
my $count = 0; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
($navmap,@sequences) = |
$count += $seq->{'num_assess_parts'}; |
&Apache::lonstatistics::selected_sequences_with_assessments(); |
|
if (! ref($navmap)) { |
|
$r->print('<h1>'.&mt('A course-wide error occured.').'</h1>'. |
|
'<h3>'.$navmap.'</h3>'); |
|
return; |
|
} |
|
foreach my $seq (@sequences) { |
|
my @resources = |
|
&Apache::lonstathelpers::get_resources($navmap,$seq); |
|
$count += scalar(@resources); |
} |
} |
if ($count > 10) { |
if ($count > 10) { |
$r->print('<h2>'. |
$r->print('<h2>'. |
Line 704 sub BuildProblemStatisticsPage {
|
Line 765 sub BuildProblemStatisticsPage {
|
sub output_sequence_statistics { |
sub output_sequence_statistics { |
my ($r) = @_; |
my ($r) = @_; |
my $c=$r->connection(); |
my $c=$r->connection(); |
$r->print('<h2>'.&mt('Sequence Statistics').'</h2>'); |
$r->print('<h2>'.&mt('Sequence Statistics'). |
|
&Apache::loncommon::help_open_topic('Statistics_Sequence'). |
|
'</h2>'); |
$r->print('<table border="0"><tr><td bgcolor="#777777">'."\n". |
$r->print('<table border="0"><tr><td bgcolor="#777777">'."\n". |
'<table border="0" cellpadding="3">'."\n". |
'<table border="0" cellpadding="3">'."\n". |
'<tr bgcolor="#FFFFE6">'); |
'<tr bgcolor="#FFFFE6">'); |
$r->print(&sequence_html_header()); |
$r->print(&sequence_html_header()); |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
last if ($c->aborted); |
last if ($c->aborted); |
next if ($seq->{'num_assess'} < 1); |
|
&compute_sequence_statistics($seq); |
&compute_sequence_statistics($seq); |
$r->print(&sequence_html_output($seq)); |
$r->print(&sequence_html_output($seq)); |
} |
} |
Line 734 sub output_html_by_sequence {
|
Line 796 sub output_html_by_sequence {
|
my $c = $r->connection(); |
my $c = $r->connection(); |
$r->print(&html_preamble()); |
$r->print(&html_preamble()); |
# |
# |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
last if ($c->aborted); |
last if ($c->aborted); |
next if ($seq->{'num_assess'} < 1); |
$r->print("<h3>".$seq->compTitle."</h3>". |
$r->print("<h3>".$seq->{'title'}."</h3>". |
|
'<table border="0"><tr><td bgcolor="#777777">'."\n". |
'<table border="0"><tr><td bgcolor="#777777">'."\n". |
'<table border="0" cellpadding="3">'."\n". |
'<table border="0" cellpadding="3">'."\n". |
'<tr bgcolor="#FFFFE6">'. |
'<tr bgcolor="#FFFFE6">'. |
Line 817 sub statistics_html_table_data {
|
Line 878 sub statistics_html_table_data {
|
if (exists($field->{'special'}) && $field->{'special'} eq 'link') { |
if (exists($field->{'special'}) && $field->{'special'} eq 'link') { |
$row .= '<a href="'.$data->{$field->{'name'}.'.link'}.'">'; |
$row .= '<a href="'.$data->{$field->{'name'}.'.link'}.'">'; |
} |
} |
if (exists($field->{'format'})) { |
if (exists($field->{'format'}) && $data->{$field->{'name'}} !~ /[A-Z]/i) { |
$row .= sprintf($field->{'format'},$data->{$field->{'name'}}); |
$row .= sprintf($field->{'format'},$data->{$field->{'name'}}); |
} else { |
} else { |
$row .= $data->{$field->{'name'}}; |
$row .= $data->{$field->{'name'}}; |
Line 874 sub sequence_html_header {
|
Line 935 sub sequence_html_header {
|
|
|
sub sequence_html_output { |
sub sequence_html_output { |
my ($seq) = @_; |
my ($seq) = @_; |
my $data = $SeqStat{$seq->{'symb'}}; |
my $data = $SeqStat{$seq->symb}; |
my $row = '<tr>'; |
my $row = '<tr>'; |
foreach my $field (@SeqFields) { |
foreach my $field (@SeqFields) { |
next if ($field->{'selected'} ne 'yes'); |
next if ($field->{'selected'} ne 'yes'); |
Line 1286 sub Excel_output {
|
Line 1347 sub Excel_output {
|
## |
## |
&write_headers($excel_sheet,$format,\$rows_output,\$cols_output, |
&write_headers($excel_sheet,$format,\$rows_output,\$cols_output, |
\@SeqFields); |
\@SeqFields); |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
next if ($seq->{'num_assess'} < 1); |
my $data = $SeqStat{$seq->symb}; |
my $data = $SeqStat{$seq->{'symb'}}; |
|
$cols_output=0; |
$cols_output=0; |
foreach my $field (@SeqFields) { |
foreach my $field (@SeqFields) { |
next if ($field->{'selected'} ne 'yes'); |
next if ($field->{'selected'} ne 'yes'); |
Line 1384 sub write_headers {
|
Line 1444 sub write_headers {
|
sub compute_statistics_on_sequence { |
sub compute_statistics_on_sequence { |
my ($seq) = @_; |
my ($seq) = @_; |
my @Data; |
my @Data; |
foreach my $res (@{$seq->{'contents'}}) { |
foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) { |
next if ($res->{'type'} ne 'assessment'); |
foreach my $part (@{$res->parts}) { |
foreach my $part (@{$res->{'parts'}}) { |
next if ($res->is_survey($part)); |
next if ($res->{'partdata'}->{$part}->{'Survey'}); |
|
# |
# |
# This is where all the work happens |
# This is where all the work happens |
my $data = &get_statistics($seq,$res,$part,scalar(@StatsArray)+1); |
my $data = &get_statistics($seq,$res,$part,scalar(@StatsArray)+1); |
Line 1405 sub compute_all_statistics {
|
Line 1464 sub compute_all_statistics {
|
return; |
return; |
} |
} |
my $c = $r->connection; |
my $c = $r->connection; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
last if ($c->aborted); |
last if ($c->aborted); |
next if ($seq->{'num_assess'} < 1); |
|
&compute_sequence_statistics($seq); |
&compute_sequence_statistics($seq); |
&compute_statistics_on_sequence($seq); |
&compute_statistics_on_sequence($seq); |
} |
} |
Line 1494 sub get_statistics {
|
Line 1552 sub get_statistics {
|
my ($sequence,$resource,$part,$problem_num) = @_; |
my ($sequence,$resource,$part,$problem_num) = @_; |
# |
# |
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); |
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); |
my $symb = $resource->{'symb'}; |
my $symb = $resource->symb; |
my $courseid = $ENV{'request.course.id'}; |
my $courseid = $ENV{'request.course.id'}; |
# |
# |
my $data = &Apache::loncoursedata::get_problem_statistics |
my $data = &Apache::loncoursedata::get_problem_statistics |
Line 1504 sub get_statistics {
|
Line 1562 sub get_statistics {
|
$data->{'symb'} = $symb; |
$data->{'symb'} = $symb; |
$data->{'part'} = $part; |
$data->{'part'} = $part; |
$data->{'problem_num'} = $problem_num; |
$data->{'problem_num'} = $problem_num; |
$data->{'container'} = $sequence->{'title'}; |
$data->{'container'} = $sequence->compTitle; |
$data->{'title'} = $resource->{'title'}; |
$data->{'title'} = $resource->compTitle; |
$data->{'title.link'} = $resource->{'src'}.'?symb='. |
$data->{'title.link'} = $resource->src.'?symb='. |
&Apache::lonnet::escape($resource->{'symb'}); |
&Apache::lonnet::escape($resource->symb); |
# |
# |
if ($SelectedFields{'deg_of_disc'}) { |
if ($SelectedFields{'deg_of_disc'}) { |
$data->{'deg_of_disc'} = |
$data->{'deg_of_disc'} = |
Line 1521 sub get_statistics {
|
Line 1579 sub get_statistics {
|
$sections =~ s/&+/_/g; # Ensure no special characters |
$sections =~ s/&+/_/g; # Ensure no special characters |
$data->{'sections'}=$sections; |
$data->{'sections'}=$sections; |
$data->{'course'} = $ENV{'request.course.id'}; |
$data->{'course'} = $ENV{'request.course.id'}; |
my $urlres=(&Apache::lonnet::decode_symb($resource->{'symb'}))[2]; |
my $urlres=(&Apache::lonnet::decode_symb($resource->symb))[2]; |
$data->{'urlres'}=$urlres; |
$data->{'urlres'}=$urlres; |
my %storestats = |
my %storestats = |
&LONCAPA::lonmetadata::dynamic_metadata_storage($data); |
&LONCAPA::lonmetadata::dynamic_metadata_storage($data); |
Line 1529 sub get_statistics {
|
Line 1587 sub get_statistics {
|
&Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user); |
&Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user); |
} |
} |
# |
# |
|
$data->{'tries_per_correct'} = $data->{'tries'} / |
|
($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'} = |
# $data->{'duedate'} = |
# &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb); |
# &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb); |
# $data->{'opendate'} = |
# $data->{'opendate'} = |
# &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb); |
# &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb); |
|
# $data->{'maxtries'} = |
|
# &Apache::lonnet::EXT('resource.'.$part.'.maxtries',$symb); |
|
# $data->{'hinttries'} = |
|
# &Apache::lonnet::EXT('resource.'.$part.'.hinttries',$symb); |
|
$data->{'weight'} = |
|
&Apache::lonnet::EXT('resource.'.$part.'.weight',$symb); |
# $data->{'resptypes'} = join(',',@{$resource->{'partdata'}->{$part}->{'ResponseTypes'}}); |
# $data->{'resptypes'} = join(',',@{$resource->{'partdata'}->{$part}->{'ResponseTypes'}}); |
return $data; |
return $data; |
} |
} |
Line 1554 Returns: integer between -1 and 1
|
Line 1621 Returns: integer between -1 and 1
|
############################################### |
############################################### |
############################################### |
############################################### |
sub compute_discrimination_factor { |
sub compute_discrimination_factor { |
my ($resource,$part,$sequence) = @_; |
my ($resource,$part,$seq) = @_; |
|
my $symb = $resource->symb; |
my @Resources; |
my @Resources; |
foreach my $res (@{$sequence->{'contents'}}) { |
foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)){ |
next if ($res->{'symb'} eq $resource->{'symb'}); |
next if ($res->symb eq $symb); |
push (@Resources,$res->{'symb'}); |
push (@Resources,$res->symb); |
} |
} |
# |
# |
# rank |
# rank |
Line 1579 sub compute_discrimination_factor {
|
Line 1647 sub compute_discrimination_factor {
|
map { |
map { |
$_->[&Apache::loncoursedata::RNK_student()]; |
$_->[&Apache::loncoursedata::RNK_student()]; |
} @{$ranking}[($num_students-$number_to_grab)..($num_students-1)]; |
} @{$ranking}[($num_students-$number_to_grab)..($num_students-1)]; |
|
if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') || |
|
! @TopSet || (@TopSet == 1 && $TopSet[0] eq '')) { |
|
return 'nan'; |
|
} |
my ($bottom_sum,$bottom_max) = |
my ($bottom_sum,$bottom_max) = |
&Apache::loncoursedata::get_sum_of_scores($resource,$part,\@BottomSet, |
&Apache::loncoursedata::get_sum_of_scores($symb,$part,\@BottomSet, |
undef,$starttime,$endtime); |
undef,$starttime,$endtime); |
my ($top_sum,$top_max) = |
my ($top_sum,$top_max) = |
&Apache::loncoursedata::get_sum_of_scores($resource,$part,\@TopSet, |
&Apache::loncoursedata::get_sum_of_scores($symb,$part,\@TopSet, |
undef,$starttime,$endtime); |
undef,$starttime,$endtime); |
my $deg_of_disc; |
my $deg_of_disc; |
if ($top_max == 0 || $bottom_max==0) { |
if ($top_max == 0 || $bottom_max==0) { |
Line 1615 sub compute_discrimination_factor {
|
Line 1687 sub compute_discrimination_factor {
|
############################################### |
############################################### |
sub compute_sequence_statistics { |
sub compute_sequence_statistics { |
my ($seq) = @_; |
my ($seq) = @_; |
my $symb = $seq->{'symb'}; |
my $symb = $seq->symb; |
my @Resources; |
my @Resources; |
foreach my $res (@{$seq->{'contents'}}) { |
my $part_count; |
next if ($res->{'type'} ne 'assessment'); |
foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) { |
push (@Resources,$res->{'symb'}); |
push (@Resources,$res->symb); |
|
$part_count += scalar(@{$res->parts}); |
} |
} |
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); |
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits(); |
# |
# |
Line 1629 sub compute_sequence_statistics {
|
Line 1702 sub compute_sequence_statistics {
|
(\@Apache::lonstatistics::SelectedSections, |
(\@Apache::lonstatistics::SelectedSections, |
$Apache::lonstatistics::enrollment_status, |
$Apache::lonstatistics::enrollment_status, |
\@Resources,$starttime,$endtime,undef); |
\@Resources,$starttime,$endtime,undef); |
$SeqStat{$symb}->{'title'} = $seq->{'title'}; |
$SeqStat{$symb}->{'title'} = $seq->compTitle; |
$SeqStat{$symb}->{'scoremax'} = $smax; |
$SeqStat{$symb}->{'scoremax'} = $smax; |
$SeqStat{$symb}->{'scoremin'} = $smin; |
$SeqStat{$symb}->{'scoremin'} = $smin; |
$SeqStat{$symb}->{'scoremean'} = $sMean; |
$SeqStat{$symb}->{'scoremean'} = $sMean; |
Line 1644 sub compute_sequence_statistics {
|
Line 1717 sub compute_sequence_statistics {
|
(\@Apache::lonstatistics::SelectedSections, |
(\@Apache::lonstatistics::SelectedSections, |
$Apache::lonstatistics::enrollment_status, |
$Apache::lonstatistics::enrollment_status, |
\@Resources,$starttime,$endtime,undef); |
\@Resources,$starttime,$endtime,undef); |
my $K = $seq->{'num_assess_parts'}; |
my $K = $part_count; |
my $kr_21; |
my $kr_21; |
if ($K > 1 && $cSTD > 0) { |
if ($K > 1 && $cSTD > 0) { |
$kr_21 = ($K/($K-1)) * (1 - $cMean*($K-$cMean)/($K*$cSTD**2)); |
$kr_21 = ($K/($K-1)) * (1 - $cMean*($K-$cMean)/($K*$cSTD**2)); |