version 1.114, 2005/02/25 19:48:01
|
version 1.115, 2005/02/25 23:32:23
|
Line 581 sub CreateAndParseOutputDataSelector {
|
Line 581 sub CreateAndParseOutputDataSelector {
|
|
|
####################################################### |
####################################################### |
####################################################### |
####################################################### |
|
sub count_parts { |
|
my ($navmap,$sequence) = @_; |
|
my @resources = &get_resources($navmap,$sequence); |
|
my $count = 0; |
|
foreach my $res (@resources) { |
|
$count += scalar(@{$res->parts}); |
|
} |
|
return $count; |
|
} |
|
|
|
sub get_resources { |
|
my ($navmap,$sequence) = @_; |
|
my @resources = $navmap->retrieveResources($sequence, |
|
sub { shift->is_problem(); }, |
|
0,0,0); |
|
return @resources; |
|
} |
|
|
|
####################################################### |
|
####################################################### |
|
|
=pod |
=pod |
|
|
Line 620 sub html_initialize {
|
Line 640 sub html_initialize {
|
$nodata_count = 0; |
$nodata_count = 0; |
undef(%prog_state); |
undef(%prog_state); |
undef(%width); |
undef(%width); |
|
# |
undef($navmap); |
undef($navmap); |
undef(@sequences); |
undef(@sequences); |
&Apache::lonnet::logthis('called html_initialize'); |
($navmap,@sequences) = |
|
&Apache::lonstatistics::selected_sequences_with_assessments(); |
|
if (! ref($navmap)) { |
|
# Unable to get data, so bail out |
|
$r->print("<h3>". |
|
&mt('Unable to retrieve course information.'). |
|
'</h3>'); |
|
} |
# |
# |
$r->print("<h3>".$ENV{'course.'.$ENV{'request.course.id'}.'.description'}. |
$r->print("<h3>".$ENV{'course.'.$ENV{'request.course.id'}.'.description'}. |
" ".localtime(time)."</h3>"); |
" ".localtime(time)."</h3>"); |
Line 642 sub html_initialize {
|
Line 670 sub html_initialize {
|
# |
# |
# Compute the column widths and output the sequence titles |
# Compute the column widths and output the sequence titles |
my $total_count; |
my $total_count; |
($navmap,@sequences) = |
|
&Apache::lonstatistics::selected_sequences_with_assessments(); |
|
if (! ref($navmap)) { |
|
# Unable to get data, so bail out |
|
$r->print("<h3>". |
|
&mt('Unable to retrieve course information.'). |
|
'</h3>'); |
|
} |
|
# |
# |
# Compute sequence widths |
# Compute sequence widths |
my $starttime = Time::HiRes::time; |
my $starttime = Time::HiRes::time; |
Line 679 sub html_initialize {
|
Line 699 sub html_initialize {
|
# |
# |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
# one problem per digit |
# one problem per digit |
$width{$symb}->{'width_parts'}=0; |
$width{$symb}->{'width_parts'}= &count_parts($navmap,$seq); |
$starttime = Time::HiRes::time; |
$width{$symb}->{'width_problem'} += $width{$symb}->{'width_parts'}; |
my @resources = |
|
$navmap->retrieveResources($seq,sub { shift->is_problem(); }, |
|
0,0,0); |
|
$starttime = Time::HiRes::time; |
|
foreach my $res (@resources) { |
|
my @parts = @{$res->parts}; |
|
$width{$symb}->{'width_parts'} += scalar(@parts); |
|
} |
|
&Apache::lonnet::logthis('2elapsed:'.(Time::HiRes::time-$starttime)); $width{$symb}->{'width_problem'} += |
|
$width{$symb}->{'width_parts'}; |
|
} else { |
} else { |
$width{$symb}->{'width_problem'} = 0; |
$width{$symb}->{'width_problem'} = 0; |
} |
} |
Line 769 sub html_outputstudent {
|
Line 779 sub html_outputstudent {
|
$ratio .= ' '; |
$ratio .= ' '; |
} |
} |
if ($chosen_output->{'sequence_sum'} && $score ne ' ') { |
if ($chosen_output->{'sequence_sum'} && $score ne ' ') { |
$ratio .= sprintf("%3.0f",$score); |
my $score .= sprintf("%3.0f",$score); |
|
$ratio .= (' 'x(3-length($score))).$score; |
} elsif($chosen_output->{'sequence_sum'}) { |
} elsif($chosen_output->{'sequence_sum'}) { |
$ratio .= ' 'x3; |
$ratio .= ' 'x3; |
} |
} |
Line 812 sub html_outputstudent {
|
Line 823 sub html_outputstudent {
|
$score = ' ' x $total_sum_width; |
$score = ' ' x $total_sum_width; |
} else { |
} else { |
$score = sprintf("%.0f",$score); |
$score = sprintf("%.0f",$score); |
|
$score = (' 'x(3-length($score))).$score; |
} |
} |
$Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max; |
$Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max; |
$Str .= " \n"; |
$Str .= " \n"; |
Line 870 sub StudentAverageTotal {
|
Line 882 sub StudentAverageTotal {
|
} |
} |
|
|
sub SingleStudentTotal { |
sub SingleStudentTotal { |
|
return if (! defined($navmap)); |
my $student = &Apache::lonstatistics::current_student(); |
my $student = &Apache::lonstatistics::current_student(); |
my $Str = '<h3>'.&mt('Summary table for [_1] ([_2]@[_3])', |
my $Str = '<h3>'.&mt('Summary table for [_1] ([_2]@[_3])', |
$student->{'fullname'}, |
$student->{'fullname'}, |
Line 887 sub SingleStudentTotal {
|
Line 900 sub SingleStudentTotal {
|
$Str .= '<th>'.&mt('Maximum').'</th>'."</tr>\n"; |
$Str .= '<th>'.&mt('Maximum').'</th>'."</tr>\n"; |
my $total = 0; |
my $total = 0; |
my $total_max = 0; |
my $total_max = 0; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
my $value = $Statistics->{$seq->symb}->{'score'}; |
my $value = $Statistics->{$seq->symb}->{'score'}; |
my $max = $Statistics->{$seq->symb}->{'max'}; |
my $max = $Statistics->{$seq->symb}->{'max'}; |
$Str .= '<tr><td>'.&HTML::Entities::encode($seq->compTitle).'</td>'. |
$Str .= '<tr><td>'.&HTML::Entities::encode($seq->compTitle).'</td>'. |
Line 936 my $request_aborted;
|
Line 949 my $request_aborted;
|
|
|
my $total_formula; |
my $total_formula; |
my $maximum_formula; |
my $maximum_formula; |
|
my %formula_data; |
|
|
|
my $navmap; |
|
my @sequences; |
|
|
sub excel_initialize { |
sub excel_initialize { |
my ($r) = @_; |
my ($r) = @_; |
Line 950 sub excel_initialize {
|
Line 967 sub excel_initialize {
|
undef ($total_formula); |
undef ($total_formula); |
undef ($maximum_formula); |
undef ($maximum_formula); |
# |
# |
|
undef(%formula_data); |
|
# |
|
undef($navmap); |
|
undef(@sequences); |
|
($navmap,@sequences) = |
|
&Apache::lonstatistics::selected_sequences_with_assessments(); |
|
if (! ref($navmap)) { |
|
# Unable to get data, so bail out |
|
$r->print("<h3>". |
|
&mt('Unable to retrieve course information.'). |
|
'</h3>'); |
|
} |
|
# |
my $total_columns = scalar(&get_student_fields_to_show()); |
my $total_columns = scalar(&get_student_fields_to_show()); |
my $num_students = scalar(@Apache::lonstatistics::Students); |
my $num_students = scalar(@Apache::lonstatistics::Students); |
# |
# |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
$total_columns += $seq->{'num_assess_parts'}; |
$total_columns+=&count_parts($navmap,$seq); |
} |
} |
# Add 2 because we need a 'sequence_sum' and 'total' column for each |
# Add 2 because we need a 'sequence_sum' and 'total' column for each |
$total_columns += 2; |
$total_columns += 2; |
Line 993 sub excel_initialize {
|
Line 1023 sub excel_initialize {
|
my $summary_header_row; |
my $summary_header_row; |
if ($chosen_output->{'summary_table'}) { |
if ($chosen_output->{'summary_table'}) { |
$summary_header_row = $rows_output++; |
$summary_header_row = $rows_output++; |
$rows_output+= scalar(&Apache::lonstatistics::Sequences_with_Assess()); |
$rows_output+= scalar(@sequences); |
$rows_output++; |
$rows_output++; |
} |
} |
my $sequence_name_row = $rows_output++; |
my $sequence_name_row = $rows_output++; |
Line 1084 sub excel_initialize {
|
Line 1114 sub excel_initialize {
|
# Add the remaining column headers |
# Add the remaining column headers |
my $total_formula_string = '=0'; |
my $total_formula_string = '=0'; |
my $maximum_formula_string = '=0'; |
my $maximum_formula_string = '=0'; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
|
my $symb = $seq->symb; |
$excel_sheet->write($sequence_name_row,, |
$excel_sheet->write($sequence_name_row,, |
$cols_output,$seq->{'title'},$format->{'bold'}); |
$cols_output,$seq->compTitle,$format->{'bold'}); |
# Determine starting cell |
# Determine starting cell |
$seq->{'Excel:startcell'}= |
$formula_data{$symb}->{'Excel:startcell'}= |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($first_data_row,$cols_output); |
($first_data_row,$cols_output); |
$seq->{'Excel:startcol'}=$cols_output; |
$formula_data{$symb}->{'Excel:startcol'}=$cols_output; |
my $count = 0; |
my $count = 0; |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
# Put the names of the problems and parts into the sheet |
# Put the names of the problems and parts into the sheet |
foreach my $res (@{$seq->{'contents'}}) { |
foreach my $res (&get_resources($navmap,$seq)) { |
if ($res->{'type'} ne 'assessment' || |
if (scalar(@{$res->parts}) > 1) { |
! exists($res->{'parts'}) || |
foreach my $part (@{$res->parts}) { |
ref($res->{'parts'}) ne 'ARRAY' || |
|
scalar(@{$res->{'parts'}}) < 1) { |
|
next; |
|
} |
|
if (scalar(@{$res->{'parts'}}) > 1) { |
|
foreach my $part (@{$res->{'parts'}}) { |
|
$excel_sheet->write($resource_name_row, |
$excel_sheet->write($resource_name_row, |
$cols_output++, |
$cols_output++, |
$res->{'title'}.' part '.$part, |
$res->compTitle.' part '.$res->part_display($part), |
$format->{'bold'}); |
$format->{'bold'}); |
$count++; |
$count++; |
} |
} |
} else { |
} else { |
$excel_sheet->write($resource_name_row, |
$excel_sheet->write($resource_name_row, |
$cols_output++, |
$cols_output++, |
$res->{'title'},$format->{'bold'}); |
$res->compTitle,$format->{'bold'}); |
$count++; |
$count++; |
} |
} |
} |
} |
} |
} |
# Determine ending cell |
# Determine ending cell |
if ($count <= 1) { |
if ($count <= 1) { |
$seq->{'Excel:endcell'} = $seq->{'Excel:startcell'}; |
$formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'}; |
$seq->{'Excel:endcol'} = $seq->{'Excel:startcol'}; |
$formula_data{$symb}->{'Excel:endcol'} = $formula_data{$symb}->{'Excel:startcol'}; |
} else { |
} else { |
$seq->{'Excel:endcell'} = |
$formula_data{$symb}->{'Excel:endcell'} = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($first_data_row,$cols_output-1); |
($first_data_row,$cols_output-1); |
$seq->{'Excel:endcol'} = $cols_output-1; |
$formula_data{$symb}->{'Excel:endcol'} = $cols_output-1; |
} |
} |
# Create the formula for summing up this sequence |
# Create the formula for summing up this sequence |
if (! exists($seq->{'Excel:endcell'}) || |
if (! exists($formula_data{$symb}->{'Excel:endcell'}) || |
! defined($seq->{'Excel:endcell'})) { |
! defined($formula_data{$symb}->{'Excel:endcell'})) { |
$seq->{'Excel:endcell'} = $seq->{'Excel:startcell'}; |
$formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'}; |
} |
} |
$seq->{'Excel:sum'}= $excel_sheet->store_formula |
$formula_data{$symb}->{'Excel:sum'}= $excel_sheet->store_formula |
('=SUM('.$seq->{'Excel:startcell'}. |
('=SUM('.$formula_data{$symb}->{'Excel:startcell'}. |
':'.$seq->{'Excel:endcell'}.')'); |
':'.$formula_data{$symb}->{'Excel:endcell'}.')'); |
# Determine cell the score is held in |
# Determine cell the score is held in |
$seq->{'Excel:scorecell'} = |
$formula_data{$symb}->{'Excel:scorecell'} = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($first_data_row,$cols_output); |
($first_data_row,$cols_output); |
$seq->{'Excel:scorecol'}=$cols_output; |
$formula_data{$symb}->{'Excel:scorecol'}=$cols_output; |
if ($chosen_output->{'base'} eq 'parts correct total') { |
if ($chosen_output->{'base'} eq 'parts correct total') { |
$excel_sheet->write($resource_name_row,$cols_output++, |
$excel_sheet->write($resource_name_row,$cols_output++, |
'parts correct', |
'parts correct', |
Line 1165 sub excel_initialize {
|
Line 1190 sub excel_initialize {
|
$excel_sheet->write($resource_name_row,$cols_output, |
$excel_sheet->write($resource_name_row,$cols_output, |
'maximum', |
'maximum', |
$format->{'bold'}); |
$format->{'bold'}); |
$seq->{'Excel:maxcell'} = |
$formula_data{$symb}->{'Excel:maxcell'} = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($first_data_row,$cols_output); |
($first_data_row,$cols_output); |
$seq->{'Excel:maxcol'}=$cols_output; |
$formula_data{$symb}->{'Excel:maxcol'}=$cols_output; |
$maximum_formula_string.='+'. |
$maximum_formula_string.='+'. |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($first_data_row,$cols_output); |
($first_data_row,$cols_output); |
Line 1204 sub excel_initialize {
|
Line 1229 sub excel_initialize {
|
# Add the maximums for each sequence or assessment |
# Add the maximums for each sequence or assessment |
my %total_cell_translation; |
my %total_cell_translation; |
my %maximum_cell_translation; |
my %maximum_cell_translation; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
$cols_output=$seq->{'Excel:startcol'}; |
my $symb = $seq->symb; |
$total_cell_translation{$seq->{'Excel:scorecell'}} = |
$cols_output=$formula_data{$symb}->{'Excel:startcol'}; |
|
$total_cell_translation{$formula_data{$symb}->{'Excel:scorecell'}}= |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($maximum_data_row,$seq->{'Excel:scorecol'}); |
($maximum_data_row,$formula_data{$symb}->{'Excel:scorecol'}); |
$maximum_cell_translation{$seq->{'Excel:maxcell'}} = |
$maximum_cell_translation{$formula_data{$symb}->{'Excel:maxcell'}}= |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($maximum_data_row,$seq->{'Excel:maxcol'}); |
($maximum_data_row,$formula_data{$symb}->{'Excel:maxcol'}); |
my $weight; |
my $weight; |
my $max = 0; |
my $max = 0; |
foreach my $resource (@{$seq->{'contents'}}) { |
foreach my $resource (&get_resources($navmap,$seq)) { |
next if ($resource->{'type'} ne 'assessment'); |
foreach my $part (@{$resource->parts}){ |
foreach my $part (@{$resource->{'parts'}}) { |
|
$weight = 1; |
$weight = 1; |
if ($chosen_output->{'scores'}) { |
if ($chosen_output->{'scores'}) { |
$weight = &Apache::lonnet::EXT |
$weight = &Apache::lonnet::EXT |
Line 1238 sub excel_initialize {
|
Line 1263 sub excel_initialize {
|
if ($chosen_output->{'sequence_sum'} && |
if ($chosen_output->{'sequence_sum'} && |
$chosen_output->{'every_problem'}) { |
$chosen_output->{'every_problem'}) { |
my %replaceCells= |
my %replaceCells= |
('^'.$seq->{'Excel:startcell'}.':'. |
('^'.$formula_data{$symb}->{'Excel:startcell'}.':'. |
$seq->{'Excel:endcell'}.'$' => |
$formula_data{$symb}->{'Excel:endcell'}.'$' => |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$seq->{'Excel:startcol'}).':'. |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:startcol'}).':'. |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$seq->{'Excel:endcol'})); |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:endcol'})); |
$excel_sheet->repeat_formula($maximum_data_row,$cols_output++, |
$excel_sheet->repeat_formula($maximum_data_row,$cols_output++, |
$seq->{'Excel:sum'},undef, |
$formula_data{$symb}->{'Excel:sum'},undef, |
%replaceCells); |
%replaceCells); |
|
|
} elsif ($chosen_output->{'sequence_sum'}) { |
} elsif ($chosen_output->{'sequence_sum'}) { |
Line 1284 sub excel_initialize {
|
Line 1309 sub excel_initialize {
|
$excel_sheet->write($summary_header_row,$cols_output++, |
$excel_sheet->write($summary_header_row,$cols_output++, |
'Std Dev',$format->{'bold'}); |
'Std Dev',$format->{'bold'}); |
my $row = $summary_header_row+1; |
my $row = $summary_header_row+1; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
|
my $symb = $seq->symb; |
$cols_output = 0; |
$cols_output = 0; |
$excel_sheet->write($row,$cols_output++, |
$excel_sheet->write($row,$cols_output++, |
$seq->{'title'}, |
$seq->compTitle, |
$format->{'bold'}); |
$format->{'bold'}); |
if ($chosen_output->{'maximum_row'}) { |
if ($chosen_output->{'maximum_row'}) { |
$excel_sheet->write |
$excel_sheet->write |
($row,$cols_output++, |
($row,$cols_output++, |
'='. |
'='. |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($maximum_data_row,$seq->{'Excel:scorecol'}) |
($maximum_data_row,$formula_data{$symb}->{'Excel:scorecol'}) |
); |
); |
} |
} |
my $range = |
my $range = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($first_data_row,$seq->{'Excel:scorecol'}). |
($first_data_row,$formula_data{$symb}->{'Excel:scorecol'}). |
':'. |
':'. |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($first_data_row+$num_students-1,$seq->{'Excel:scorecol'}); |
($first_data_row+$num_students-1,$formula_data{$symb}->{'Excel:scorecol'}); |
$excel_sheet->write($row,$cols_output++, |
$excel_sheet->write($row,$cols_output++, |
'=AVERAGE('.$range.')'); |
'=AVERAGE('.$range.')'); |
$excel_sheet->write($row,$cols_output++, |
$excel_sheet->write($row,$cols_output++, |
Line 1344 sub excel_initialize {
|
Line 1370 sub excel_initialize {
|
|
|
sub excel_outputstudent { |
sub excel_outputstudent { |
my ($r,$student) = @_; |
my ($r,$student) = @_; |
return if ($request_aborted); |
if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) { |
return if (! defined($excel_sheet)); |
return; |
|
} |
$cols_output=0; |
$cols_output=0; |
# |
# |
# Write out student data |
# Write out student data |
Line 1372 sub excel_outputstudent {
|
Line 1399 sub excel_outputstudent {
|
# Write out sequence scores and totals data |
# Write out sequence scores and totals data |
my %total_cell_translation; |
my %total_cell_translation; |
my %maximum_cell_translation; |
my %maximum_cell_translation; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
$cols_output = $seq->{'Excel:startcol'}; |
my $symb = $seq->symb; |
|
$cols_output = $formula_data{$symb}->{'Excel:startcol'}; |
# Keep track of cells to translate in total cell |
# Keep track of cells to translate in total cell |
$total_cell_translation{$seq->{'Excel:scorecell'}} = |
$total_cell_translation{$formula_data{$symb}->{'Excel:scorecell'}} = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($rows_output,$seq->{'Excel:scorecol'}); |
($rows_output,$formula_data{$symb}->{'Excel:scorecol'}); |
# and maximum cell |
# and maximum cell |
$maximum_cell_translation{$seq->{'Excel:maxcell'}} = |
$maximum_cell_translation{$formula_data{$symb}->{'Excel:maxcell'}} = |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell |
($rows_output,$seq->{'Excel:maxcol'}); |
($rows_output,$formula_data{$symb}->{'Excel:maxcol'}); |
# |
# |
my ($performance,$performance_length,$score,$seq_max,$rawdata); |
my ($performance,$performance_length,$score,$seq_max,$rawdata); |
if ($chosen_output->{'tries'} || $chosen_output->{'correct'}){ |
if ($chosen_output->{'tries'} || $chosen_output->{'correct'}){ |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
&StudentTriesOnSequence($student,\%StudentsData, |
&student_tries_on_sequence($student,\%StudentsData, |
$seq,'no'); |
$navmap,$seq,'no'); |
} else { |
} else { |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
&StudentPerformanceOnSequence($student,\%StudentsData, |
&student_performance_on_sequence($student,\%StudentsData, |
$seq,'no'); |
$navmap,$seq,'no'); |
} |
} |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'correct'}) { |
if ($chosen_output->{'correct'}) { |
Line 1416 sub excel_outputstudent {
|
Line 1444 sub excel_outputstudent {
|
$chosen_output->{'every_problem'}) { |
$chosen_output->{'every_problem'}) { |
# Write a formula for the sum of this sequence |
# Write a formula for the sum of this sequence |
my %replaceCells= |
my %replaceCells= |
('^'.$seq->{'Excel:startcell'}.':'.$seq->{'Excel:endcell'}.'$' |
('^'.$formula_data{$symb}->{'Excel:startcell'}.':'.$formula_data{$symb}->{'Excel:endcell'}.'$' |
=> |
=> |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$seq->{'Excel:startcol'}).':'. |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$formula_data{$symb}->{'Excel:startcol'}).':'. |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$seq->{'Excel:endcol'}) |
&Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($rows_output,$formula_data{$symb}->{'Excel:endcol'}) |
); |
); |
# The undef is for the format |
# The undef is for the format |
$excel_sheet->repeat_formula($rows_output,$cols_output++, |
$excel_sheet->repeat_formula($rows_output,$cols_output++, |
$seq->{'Excel:sum'},undef, |
$formula_data{$symb}->{'Excel:sum'},undef, |
%replaceCells); |
%replaceCells); |
} elsif ($chosen_output->{'sequence_sum'}) { |
} elsif ($chosen_output->{'sequence_sum'}) { |
if ($score eq ' ') { |
if ($score eq ' ') { |
Line 1459 sub excel_outputstudent {
|
Line 1487 sub excel_outputstudent {
|
|
|
sub excel_finish { |
sub excel_finish { |
my ($r) = @_; |
my ($r) = @_; |
return if ($request_aborted); |
if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) { |
return if (! defined($excel_sheet)); |
return; |
|
} |
# |
# |
# Write the excel file |
# Write the excel file |
$excel_workbook->close(); |
$excel_workbook->close(); |
Line 1502 my $outputfile;
|
Line 1531 my $outputfile;
|
my $filename; |
my $filename; |
my $request_aborted; |
my $request_aborted; |
my %prog_state; # progress window state |
my %prog_state; # progress window state |
|
my $navmap; |
|
my @sequences; |
|
|
sub csv_initialize{ |
sub csv_initialize{ |
my ($r) = @_; |
my ($r) = @_; |
Line 1512 sub csv_initialize{
|
Line 1543 sub csv_initialize{
|
undef($request_aborted); |
undef($request_aborted); |
undef(%prog_state); |
undef(%prog_state); |
# |
# |
|
undef($navmap); |
|
undef(@sequences); |
|
($navmap,@sequences) = |
|
&Apache::lonstatistics::selected_sequences_with_assessments(); |
|
if (! ref($navmap)) { |
|
# Unable to get data, so bail out |
|
$r->print("<h3>". |
|
&mt('Unable to retrieve course information.'). |
|
'</h3>'); |
|
} |
|
# |
# Deal with unimplemented requests |
# Deal with unimplemented requests |
$request_aborted = undef; |
$request_aborted = undef; |
if ($chosen_output->{'base'} =~ /final table/) { |
if ($chosen_output->{'base'} =~ /final table/) { |
Line 1563 END
|
Line 1605 END
|
$sequence_row .='"",'; |
$sequence_row .='"",'; |
$resource_row .= '"'.&Apache::loncommon::csv_translate($field).'",'; |
$resource_row .= '"'.&Apache::loncommon::csv_translate($field).'",'; |
} |
} |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
$sequence_row .= '"'. |
$sequence_row .= '"'. |
&Apache::loncommon::csv_translate($seq->{'title'}).'",'; |
&Apache::loncommon::csv_translate($seq->compTitle).'",'; |
my $count = 0; |
my $count = 0; |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
foreach my $res (@{$seq->{'contents'}}) { |
foreach my $res (@{$seq->{'contents'}}) { |
if ($res->{'type'} ne 'assessment' || |
if (scalar(@{$res->parts}) < 1) { |
! exists($res->{'parts'}) || |
|
ref($res->{'parts'}) ne 'ARRAY' || |
|
scalar(@{$res->{'parts'}}) < 1) { |
|
next; |
next; |
} |
} |
foreach my $part (@{$res->{'parts'}}) { |
foreach my $part (@{$res->parts}) { |
$resource_row .= '"'. |
$resource_row .= '"'. |
&Apache::loncommon::csv_translate($res->{'title'}. |
&Apache::loncommon::csv_translate |
', Part '.$part |
($res->compTitle.', Part '.$res->part_display($part)).'",'; |
).'",'; |
|
$count++; |
$count++; |
} |
} |
} |
} |
Line 1614 END
|
Line 1652 END
|
|
|
sub csv_outputstudent { |
sub csv_outputstudent { |
my ($r,$student) = @_; |
my ($r,$student) = @_; |
return if ($request_aborted); |
if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) { |
return if (! defined($outputfile)); |
return; |
|
} |
my $Str = ''; |
my $Str = ''; |
# |
# |
# Output student fields |
# Output student fields |
Line 1642 sub csv_outputstudent {
|
Line 1681 sub csv_outputstudent {
|
# Output performance data |
# Output performance data |
my $total = 0; |
my $total = 0; |
my $maximum = 0; |
my $maximum = 0; |
foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) { |
foreach my $seq (@sequences) { |
my ($performance,$performance_length,$score,$seq_max,$rawdata); |
my ($performance,$performance_length,$score,$seq_max,$rawdata); |
if ($chosen_output->{'tries'}){ |
if ($chosen_output->{'tries'}){ |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
&StudentTriesOnSequence($student,\%StudentsData, |
&student_tries_on_sequence($student,\%StudentsData, |
$seq,'no'); |
$navmap,$seq,'no'); |
} else { |
} else { |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
($performance,$performance_length,$score,$seq_max,$rawdata) = |
&StudentPerformanceOnSequence($student,\%StudentsData, |
&student_performance_on_sequence($student,\%StudentsData, |
$seq,'no'); |
$navmap,$seq,'no'); |
} |
} |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'every_problem'}) { |
if ($chosen_output->{'correct'}) { |
if ($chosen_output->{'correct'}) { |
Line 1694 sub csv_outputstudent {
|
Line 1733 sub csv_outputstudent {
|
|
|
sub csv_finish { |
sub csv_finish { |
my ($r) = @_; |
my ($r) = @_; |
return if ($request_aborted); |
if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) { |
return if (! defined($outputfile)); |
return; |
|
} |
close($outputfile); |
close($outputfile); |
# |
# |
my $c = $r->connection(); |
my $c = $r->connection(); |
Line 1748 sub student_tries_on_sequence {
|
Line 1788 sub student_tries_on_sequence {
|
my @TriesData = (); |
my @TriesData = (); |
my $tries; |
my $tries; |
my $hasdata = 0; # flag - true if the student has any data on the sequence |
my $hasdata = 0; # flag - true if the student has any data on the sequence |
my @resources = |
foreach my $resource (&get_resources($navmap,$seq)) { |
$navmap->retrieveResources($seq,sub { shift->is_problem(); },0,0,0); |
|
foreach my $resource (@resources) { |
|
my $resource_data = $studentdata->{$resource->symb}; |
my $resource_data = $studentdata->{$resource->symb}; |
my $value = ''; |
my $value = ''; |
foreach my $partnum (@{$resource->parts()}) { |
foreach my $partnum (@{$resource->parts()}) { |
Line 1853 sub student_tries_on_sequence {
|
Line 1891 sub student_tries_on_sequence {
|
|
|
=pod |
=pod |
|
|
=item &StudentPerformanceOnSequence() |
=item &student_performance_on_sequence |
|
|
Inputs: |
Inputs: |
|
|
Line 1883 sub student_performance_on_sequence {
|
Line 1921 sub student_performance_on_sequence {
|
my @ScoreData = (); |
my @ScoreData = (); |
my $partscore; |
my $partscore; |
my $hasdata = 0; # flag, 0 if there were no submissions on the sequence |
my $hasdata = 0; # flag, 0 if there were no submissions on the sequence |
my @resources = |
foreach my $resource (&get_resources($navmap,$seq)) { |
$navmap->retrieveResources($seq,sub { shift->is_problem(); },0,0,0); |
|
foreach my $resource (@resources) { |
|
my $symb = $resource->symb; |
my $symb = $resource->symb; |
my $resource_data = $studentdata->{$symb}; |
my $resource_data = $studentdata->{$symb}; |
foreach my $part (@{$resource->parts()}) { |
foreach my $part (@{$resource->parts()}) { |