version 1.96, 2005/01/11 19:45:18
|
version 1.100, 2005/03/08 17:40:39
|
Line 353 my @Fields = (
|
Line 353 my @Fields = (
|
# selectable => 'no', |
# selectable => 'no', |
# defaultselected => 'yes', |
# defaultselected => 'yes', |
# }, |
# }, |
## weight included for research purposes. Commented out most of the time. |
# |
# { name => 'weight', |
## problem weight for instructor |
# title => 'weight', |
{ name => 'weight', |
# align => 'right', |
title => 'weight', |
# color => '#FFFFFF', |
align => 'right', |
# sortable => 'no', |
color => '#FFFFFF', |
# graphable => 'no', |
sortable => 'no', |
# long_title => 'Problem weight (for instructor)', |
graphable => 'no', |
# selectable => 'no', |
long_title => 'Problem weight (for instructor)', |
# defaultselected => 'yes', |
selectable => 'yes', |
# }, |
defaultselected => 'yes', |
|
}, |
); |
); |
|
|
my @SeqFields = ( |
my @SeqFields = ( |
Line 625 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 666 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 716 sub BuildProblemStatisticsPage {
|
Line 713 sub BuildProblemStatisticsPage {
|
# it does not slow things down noticably. |
# it does not slow things down noticably. |
&Apache::loncoursedata::populate_weight_table(); |
&Apache::loncoursedata::populate_weight_table(); |
# |
# |
|
($navmap,@sequences) = |
|
&Apache::lonstatistics::selected_sequences_with_assessments(); |
|
if (! ref($navmap)) { |
|
$r->print('<h1>'.&mt('A course-wide error occured.').'</h1>'. |
|
'<h3>'.$navmap.'</h3>'); |
|
return; |
|
} |
if (exists($ENV{'form.Excel'})) { |
if (exists($ENV{'form.Excel'})) { |
&Excel_output($r); |
&Excel_output($r); |
} else { |
} else { |
Line 723 sub BuildProblemStatisticsPage {
|
Line 727 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()) { |
foreach my $seq (@sequences) { |
$count += $seq->{'num_assess_parts'}; |
my @resources = |
|
&Apache::lonstathelpers::get_resources($navmap,$seq); |
|
$count += scalar(@resources); |
} |
} |
if ($count > 10) { |
if ($count > 10) { |
$r->print('<h2>'. |
$r->print('<h2>'. |
Line 766 sub output_sequence_statistics {
|
Line 772 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 791 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 931 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 1343 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 1441 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 1462 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 1551 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 1561 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 1578 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 1598 sub get_statistics {
|
Line 1599 sub get_statistics {
|
# &Apache::lonnet::EXT('resource.'.$part.'.maxtries',$symb); |
# &Apache::lonnet::EXT('resource.'.$part.'.maxtries',$symb); |
# $data->{'hinttries'} = |
# $data->{'hinttries'} = |
# &Apache::lonnet::EXT('resource.'.$part.'.hinttries',$symb); |
# &Apache::lonnet::EXT('resource.'.$part.'.hinttries',$symb); |
# $data->{'weight'} = |
$data->{'weight'} = |
# &Apache::lonnet::EXT('resource.'.$part.'.weight',$symb); |
&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 1620 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 1650 sub compute_discrimination_factor {
|
Line 1652 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 1685 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 1699 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 1714 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)); |