--- loncom/interface/statistics/lonproblemstatistics.pm 2004/04/01 20:02:56 1.79 +++ loncom/interface/statistics/lonproblemstatistics.pm 2004/05/14 20:30:17 1.85 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemstatistics.pm,v 1.79 2004/04/01 20:02:56 matthew Exp $ +# $Id: lonproblemstatistics.pm,v 1.85 2004/05/14 20:30:17 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,6 +55,7 @@ use Apache::loncommon(); use Apache::lonhtmlcommon; use Apache::loncoursedata; use Apache::lonstatistics; +use LONCAPA::lonmetadata(); use Apache::lonlocal; use Spreadsheet::WriteExcel; use Apache::lonstathelpers(); @@ -95,13 +96,17 @@ my %SeqStat; # keys are symbs, values ## statistics display? ## selected yes (yes|no) Is the column selected by default? ## +## format no sprintf format string +## +## excel_format no excel format type +## (see &Apache::loncommon::define_excel_formats my @Fields = ( { name => 'problem_num', title => 'P#', align => 'right', color => '#FFFFE6', selectable => 'no', - selected => 'yes', + defaultselected => 'yes', }, { name => 'container', title => 'Sequence or Folder', @@ -109,7 +114,7 @@ my @Fields = ( color => '#FFFFE6', sortable => 'yes', selectable => 'no', - selected => 'yes', + defaultselected => 'yes', }, { name => 'title', title => 'Title', @@ -118,14 +123,14 @@ my @Fields = ( special => 'link', sortable => 'yes', selectable => 'no', - selected => 'yes', + defaultselected => 'yes', }, { name => 'part', title => 'Part', align => 'left', color => '#FFFFE6', selectable => 'no', - selected => 'yes', + defaultselected => 'yes', }, { name => 'num_students', title => '#Stdnts', @@ -136,7 +141,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Number of Students Attempting Problem', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'tries', title => 'Tries', @@ -147,7 +152,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Total Number of Tries', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'max_tries', title => 'Max Tries', @@ -158,7 +163,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Maximum Number of Tries', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'min_tries', title => 'Min Tries', @@ -169,7 +174,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Minumum Number of Tries', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'mean_tries', title => 'Mean Tries', @@ -180,7 +185,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Average Number of Tries', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'std_tries', title => 'S.D. tries', @@ -191,7 +196,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Standard Deviation of Number of Tries', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'skew_tries', title => 'Skew Tries', @@ -202,7 +207,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Skew of Number of Tries', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'num_solved', title => '#YES', @@ -213,7 +218,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Number of Students able to Solve', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'num_override', title => '#yes', @@ -224,7 +229,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Number of Students given Override', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'num_wrong', title => '#Wrng', @@ -235,7 +240,7 @@ my @Fields = ( graphable => 'yes', long_title => 'Percent of students whose final answer is wrong', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'deg_of_diff', title => 'DoDiff', @@ -247,7 +252,7 @@ my @Fields = ( long_title => 'Degree of Difficulty'. '[ 1 - ((#YES+#yes) / Tries) ]', selectable => 'yes', - selected => 'yes', + defaultselected => 'yes', }, { name => 'deg_of_disc', title => 'DoDisc', @@ -258,8 +263,41 @@ my @Fields = ( graphable => 'yes', long_title => 'Degree of Discrimination', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, +## duedate included for research purposes. Commented out most of the time. +# { name => 'duedate', +# title => 'Due Date', +# align => 'left', +# color => '#FFFFFF', +# sortable => 'yes', +# graphable => 'no', +# long_title => 'Due date of resource for instructor', +# selectable => 'no', +# defaultselected => 'yes', +# }, +## opendate included for research purposes. Commented out most of the time. +# { name => 'opendate', +# title => 'Open Date', +# align => 'left', +# color => '#FFFFFF', +# sortable => 'yes', +# graphable => 'no', +# long_title => 'date resource became answerable', +# selectable => 'no', +# defaultselected => 'yes', +# }, +## symb included for research purposes. Commented out most of the time. +# { name => 'symb', +# title => 'Symb', +# align => 'left', +# color => '#FFFFFF', +# sortable => 'yes', +# graphable => 'no', +# long_title => 'Unique LON-CAPA identifier for problem', +# selectable => 'no', +# defaultselected => 'yes', +# }, ); my @SeqFields = ( @@ -270,7 +308,7 @@ my @SeqFields = ( special => 'no', sortable => 'no', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'items', title => '#Items', @@ -281,7 +319,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Number of Items in Sequence', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'scoremean', title => 'Score Mean', @@ -292,7 +330,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Mean Sequence Score', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'scorestd', title => 'Score STD', @@ -303,7 +341,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Standard Deviation of Sequence Scores', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'scoremax', title => 'Score Max', @@ -314,7 +352,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Maximum Sequence Score', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'scoremin', title => 'Score Min', @@ -325,7 +363,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Minumum Sequence Score', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'scorecount', title => 'Score N', @@ -336,7 +374,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Number of Students in score computations', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'countmean', title => 'Count Mean', @@ -347,7 +385,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Mean Sequence Score', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'countstd', title => 'Count STD', @@ -358,7 +396,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Standard Deviation of Sequence Scores', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'countmax', title => 'Count Max', @@ -369,7 +407,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Maximum Number of Correct Problems', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'countmin', title => 'Count Min', @@ -380,7 +418,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Minumum Number of Correct Problems', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'count', title => 'Count N', @@ -391,7 +429,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'Number of Students in score computations', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, { name => 'KR-21', title => 'KR-21', @@ -402,7 +440,7 @@ my @SeqFields = ( graphable => 'no', long_title => 'KR-21 reliability statistic', selectable => 'yes', - selected => 'no', + defaultselected => 'no', }, ); @@ -415,12 +453,28 @@ sub parse_field_selection { $ENV{'form.fieldselections'} = []; foreach my $field (@Fields) { next if ($field->{'selectable'} ne 'yes'); - if ($field->{'selected'} eq 'yes') { + if ($field->{'defaultselected'} eq 'yes') { push(@{$ENV{'form.fieldselections'}},$field->{'name'}); } } } # + # Make sure the data we are plotting is there + my %NeededFields; + if (exists($ENV{'form.plot'}) && $ENV{'form.plot'} ne '' && + $ENV{'form.plot'} ne 'none') { + if ($ENV{'form.plot'} eq 'degrees') { + $NeededFields{'deg_of_diff'}++; + $NeededFields{'deg_of_disc'}++; + } elsif ($ENV{'form.plot'} eq 'tries statistics') { + $NeededFields{'mean_tries'}++; + $NeededFields{'std_tries'}++; + $NeededFields{'problem_num'}++; + } else { + $NeededFields{$ENV{'form.plot'}}++; + } + } + # # This should not happen, but in case it does... if (ref($ENV{'form.fieldselections'}) ne 'ARRAY') { $ENV{'form.fieldselections'} = [$ENV{'form.fieldselections'}]; @@ -429,8 +483,15 @@ sub parse_field_selection { # Set the field data and the selected fields (for easier checking) undef(%SelectedFields); foreach my $field (@Fields) { - next if ($field->{'selectable'} ne 'yes'); - $field->{'selected'} = 'no'; + if ($field->{'selectable'} ne 'yes') { + $field->{'selected'} = 'yes'; + } else { + $field->{'selected'} = 'no'; + } + if (exists($NeededFields{$field->{'name'}})) { + $field->{'selected'} = 'yes'; + $SelectedFields{$field->{'name'}}++; + } foreach my $selection (@{$ENV{'form.fieldselections'}}) { if ($selection eq $field->{'name'} || $selection eq 'all') { $field->{'selected'} = 'yes'; @@ -438,6 +499,11 @@ sub parse_field_selection { } } } + # + # Always show all the sequence statistics (for now) + foreach my $field (@SeqFields) { + $field->{'selected'} = 'yes'; + } return; } @@ -470,7 +536,9 @@ select sections, maps, and output. ############################################### ############################################### sub CreateInterface { + # &parse_field_selection(); + # my $Str = ''; $Str .= &Apache::lonhtmlcommon::breadcrumbs (undef,'Overall Problem Statistics','Statistics_Overall_Key'); @@ -793,15 +861,9 @@ sub sequence_html_header { sub sequence_html_output { my ($seq) = @_; my $data = $SeqStat{$seq->{'symb'}}; -# $SeqStat{$symb}->{'max'} -# $SeqStat{$symb}->{'min'} -# $SeqStat{$symb}->{'mean'} -# $SeqStat{$symb}->{'std'} -# $SeqStat{$symb}->{'count'} -# $SeqStat{$symb}->{'max_possible'} my $row = ''; foreach my $field (@SeqFields) { -# next if ($field->{'selected'} ne 'yes'); + next if ($field->{'selected'} ne 'yes'); $row .= '{'align'})) { $row .= ' align="'.$field->{'align'}.'"'; @@ -945,6 +1007,11 @@ sub degrees_plot { my $diffdata .= ''.join(',',@Labels).''.$/. ''.join(',',@Diff).''.$/; # + my $title = 'Degree of Discrimination\nand Degree of Difficulty'; + if ($xmax > 50) { + $title = 'Degree of Discrimination and Degree of Difficulty'; + } + # $plot=<<"END"; - Degree of Discrmination and Degree of Difficulty + $title Problem Number '.join(',',@Mean).''.$/. ''.join(',',@STD).''.$/; # + my $title = 'Mean and S.D. of Tries'; + if ($xmax > 25) { + $title = 'Mean and Standard Deviation of Tries'; + } + # $plot=<<"END"; - Mean and S.D. of Tries + $title Problem Number + Number of Tries 'yes', name => 'degrees', - title => 'DoDisc and DoDiff' }, + title => 'Difficulty Indexes' }, { graphable=>'yes', name => 'tries statistics', - title => 'Mean and S.D. of Tries' }); + title => 'Tries Statistics' }); # my $Str= "\n".'