version 1.92, 2004/07/22 17:33:29
|
version 1.97, 2005/03/01 00:07:21
|
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 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', |
|
# }, |
|
## weight included for research purposes. Commented out most of the time. |
|
# { 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 625 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 657 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 719 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 711 sub output_sequence_statistics {
|
Line 771 sub output_sequence_statistics {
|
'<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 736 sub output_html_by_sequence {
|
Line 795 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 876 sub sequence_html_header {
|
Line 934 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 1288 sub Excel_output {
|
Line 1346 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 1386 sub write_headers {
|
Line 1443 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 1407 sub compute_all_statistics {
|
Line 1463 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 1496 sub get_statistics {
|
Line 1551 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 1506 sub get_statistics {
|
Line 1561 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 1523 sub get_statistics {
|
Line 1578 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 1531 sub get_statistics {
|
Line 1586 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 1556 Returns: integer between -1 and 1
|
Line 1620 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 1586 sub compute_discrimination_factor {
|
Line 1651 sub compute_discrimination_factor {
|
return 'nan'; |
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 1621 sub compute_discrimination_factor {
|
Line 1686 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 1635 sub compute_sequence_statistics {
|
Line 1701 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 1650 sub compute_sequence_statistics {
|
Line 1716 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)); |