--- loncom/interface/statistics/lonstudentassessment.pm 2003/03/07 17:01:45 1.39 +++ loncom/interface/statistics/lonstudentassessment.pm 2003/05/21 14:43:01 1.48 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.39 2003/03/07 17:01:45 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.48 2003/05/21 14:43:01 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -137,7 +137,7 @@ sub BuildStudentAssessmentPage { if (! exists($ENV{'form.notfirstrun'})) { $r->print(< - + Please make your selections in the boxes above and hit the button marked "Update Display". @@ -156,10 +156,10 @@ ENDMSG $initialize = \&excel_initialize; $output_student = \&excel_outputstudent; $finish = \&excel_finish; - } elsif ($output_mode eq 'multi-sheet excel') { - $initialize = \&multi_sheet_excel_initialize; - $output_student = \&multi_sheet_excel_outputstudent; - $finish = \&multi_sheet_excel_finish; +# } elsif ($output_mode eq 'multi-sheet excel') { +# $initialize = \&multi_sheet_excel_initialize; +# $output_student = \&multi_sheet_excel_outputstudent; +# $finish = \&multi_sheet_excel_finish; } elsif ($output_mode eq 'csv') { $initialize = \&csv_initialize; $output_student = \&csv_outputstudent; @@ -198,19 +198,6 @@ sub get_student_fields_to_show { return @to_show; } -sub get_sequences_to_show { - my @Sequences; - foreach my $map_symb (@Apache::lonstatistics::SelectedMaps) { - foreach my $sequence (@Apache::lonstatistics::Sequences) { - next if ($sequence->{'symb'} ne $map_symb && $map_symb ne 'all'); - next if ($sequence->{'num_assess'} < 1); - push (@Sequences,$sequence); - } - } - return @Sequences; -} - - ####################################################### ####################################################### @@ -237,7 +224,8 @@ sub CreateInterface { $Str .= ''; $Str .= 'Sections'; $Str .= 'Student Data'; - $Str .= 'Problem Sets'; + $Str .= 'Enrollment Status'; + $Str .= 'Sequences and Folders'; $Str .= 'Output Format'; $Str .= ''."\n"; # @@ -255,6 +243,8 @@ sub CreateInterface { $Str .= &Apache::lonstatistics::StudentDataSelect('StudentData','multiple', 5,undef); $Str .= ''."\n"; + $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); + $Str .= ''."\n"; $Str .= &Apache::lonstatistics::MapSelect('Maps','multiple,all',5, $only_seq_with_assessments); $Str .= ''."\n"; @@ -284,6 +274,15 @@ my @OutputOptions = show => 'all', show_links => 'yes', }, + { name => 'HTML, with all links', + value => 'html, with all links', + description => 'Output HTML with each symbol linked to the problem '. + 'which generated it. '. + 'This includes links for unattempted problems.', + mode => 'html', + show => 'all', + show_links => 'all', + }, { name => 'HTML, without links', value => 'html, without links', description => 'Output HTML. By not including links, the size of the'. @@ -336,27 +335,27 @@ my @OutputOptions = show => 'totals', show_links => 'no', }, - { name => 'multi-sheet Excel', - value => 'multi-sheet excel', - description => 'Output an Excel file (compatable with Excel 95), '. - 'with a seperate worksheet for each sequence you have selected '. - 'the data for each problem part '. - '(number of tries, status, points awarded) will be listed.', - mode => 'multi-sheet excel', - show => 'totals', - show_links => 'no', - }, - { name => 'multi-sheet Excel, by section', - value => 'multi-sheet excel, by section', - description => 'Output an Excel file (compatable with Excel 95), '. - 'with a seperate worksheet for each sequence you have selected '. - 'the data for each problem part '. - '(number of tries, status, points awarded) will be listed. '. - 'There will be one Excel workbook for each section selected.', - mode => 'multi-sheet excel', - show => 'by section', - show_links => 'no', - }, +# { name => 'multi-sheet Excel', +# value => 'multi-sheet excel', +# description => 'Output an Excel file (compatable with Excel 95), '. +# 'with a seperate worksheet for each sequence you have selected '. +# 'the data for each problem part '. +# '(number of tries, status, points awarded) will be listed.', +# mode => 'multi-sheet excel', +# show => 'totals', +# show_links => 'no', +# }, +# { name => 'multi-sheet Excel, by section', +# value => 'multi-sheet excel, by section', +# description => 'Output an Excel file (compatable with Excel 95), '. +# 'with a seperate worksheet for each sequence you have selected '. +# 'the data for each problem part '. +# '(number of tries, status, points awarded) will be listed. '. +# 'There will be one Excel workbook for each section selected.', +# mode => 'multi-sheet excel', +# show => 'by section', +# show_links => 'no', +# }, { name => 'CSV, everything', value => 'csv, everything', description => '', @@ -394,7 +393,7 @@ sub OutputDescriptions { sub CreateAndParseOutputSelector { my $Str = ''; - my $elementname = 'outputmode'; + my $elementname = 'chartoutputmode'; # # Format for output options is 'mode, restrictions'; my $selected = 'html, with links'; @@ -485,7 +484,7 @@ sub html_initialize { $Str .= $title.' 'x($width-$base).$padding; } # Now the selected sequences need to be listed - foreach my $sequence (&get_sequences_to_show) { + foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()){ my $title = $sequence->{'title'}; my $base = $sequence->{'base_width'}; my $width = $sequence->{'width'}; @@ -538,7 +537,7 @@ sub html_outputstudent { # By sequence build up the data my $studentstats; my $PerformanceStr = ''; - foreach my $seq (&get_sequences_to_show) { + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { my ($performance,$score,$seq_max) = &StudentPerformanceOnSequence($student,\%StudentsData, $seq,$show_links); @@ -608,9 +607,14 @@ sub StudentAverageTotal { my $total_max = 0; $Str .= ''."\n"; $Str .= "\n"; - foreach my $seq (&get_sequences_to_show) { - my $ave = int(100*($Statistics->{$seq->{'symb'}}->{'score'}/ - ($num_students-$nodata_count)))/100; + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { + my $ave; + if ($num_students > $nodata_count) { + $ave = int(100*($Statistics->{$seq->{'symb'}}->{'score'}/ + ($num_students-$nodata_count)))/100; + } else { + $ave = 0; + } $total_ave += $ave; my $max = $seq->{'num_assess_parts'}; $total_max += $max; @@ -666,7 +670,7 @@ sub multi_sheet_excel_initialize { my $num_data_per_part = 2; # 'status' and 'numtries' my $fields_per_student = scalar(&get_student_fields_to_show()); my $bytes_per_field = 20; # Back of the envelope calculation - foreach my $seq (&get_sequences_to_show) { + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { $num_sequences++ if ($seq->{'num_assess'} > 0); $fields_per_student += $num_data_per_part * $seq->{'num_assess_parts'}; } @@ -812,7 +816,7 @@ sub excel_initialize { } # # Add the Sequence Headers - foreach my $seq (&get_sequences_to_show) { + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { $excel_sheet->write($rows_output,$cols_output,$seq->{'title'}); if ($show eq 'totals') { $excel_sheet->write($rows_output+1,$cols_output,'score'); @@ -830,6 +834,26 @@ sub excel_initialize { $rows_output += 1; } # + # Output a row for MAX + if ($show ne 'totals') { + $cols_output = 0; + foreach my $field (&get_student_fields_to_show()) { + if ($field eq 'username' || $field eq 'fullname' || + $field eq 'id') { + $excel_sheet->write($rows_output,$cols_output++,'Maximum'); + } else { + $excel_sheet->write($rows_output,$cols_output++,''); + } + } + # + # Add the Sequence Headers + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { + $excel_sheet->write($rows_output,$cols_output++, + $seq->{'num_assess_parts'}); + } + $rows_output++; + } + # # Let the user know what we are doing my $studentcount = scalar(@Apache::lonstatistics::Students); $r->print("

Compiling Excel spreadsheet for ". @@ -868,7 +892,7 @@ sub excel_outputstudent { } # # Write out sequence scores and totals data - foreach my $seq (&get_sequences_to_show) { + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { my ($performance,$score,$seq_max) = &StudentPerformanceOnSequence($student,\%StudentsData, $seq,'no'); @@ -974,7 +998,7 @@ sub csv_initialize{ $Str .= '"'.&Apache::loncommon::csv_translate($field).'",'; } } - foreach my $seq (&get_sequences_to_show) { + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { if ($show eq 'scores') { $Str .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}). '",'; @@ -1028,7 +1052,7 @@ sub csv_outputstudent { } # # Output performance data - foreach my $seq (&get_sequences_to_show) { + foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { my ($performance,$score,$seq_max) = &StudentPerformanceOnSequence($student,\%StudentsData, $seq,'no'); @@ -1134,6 +1158,9 @@ sub StudentPerformanceOnSequence { $symbol = ' '; } $sum++; + } elsif (exists($resource_data->{'resource.'. + $partnum.'.tries'})){ + $symbol = '.'; } else { $symbol = ' '; } @@ -1146,7 +1173,8 @@ sub StudentPerformanceOnSequence { } } # - if ($links eq 'yes' && $symbol ne ' ') { + if ( ($links eq 'yes' && $symbol ne ' ') || + ($links eq 'all')) { $symbol = '

TitleAverageMaximum