--- loncom/interface/statistics/lonstudentassessment.pm 2005/08/26 21:53:23 1.125 +++ loncom/interface/statistics/lonstudentassessment.pm 2006/01/29 19:39:03 1.129 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.125 2005/08/26 21:53:23 albertel Exp $ +# $Id: lonstudentassessment.pm,v 1.129 2006/01/29 19:39:03 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -472,6 +472,7 @@ my @OutputDataOptions = grand_maximum => 1, summary_table => 1, maximum_row => 1, + ignore_weight => 0, shortdesc => 'Total Score and Maximum Possible for each '. 'Sequence or Folder', longdesc => 'The score of each student as well as the '. @@ -490,6 +491,7 @@ my @OutputDataOptions = grand_maximum => 1, summary_table => 1, maximum_row => 1, + ignore_weight => 0, shortdesc => 'Score on each Problem Part', longdesc =>'The students score on each problem part, computed as'. 'the part weight * part awarded', @@ -507,6 +509,7 @@ my @OutputDataOptions = grand_maximum => 0, summary_table => 0, maximum_row => 0, + ignore_weight => 0, shortdesc => 'Number of Tries before success on each Problem Part', longdesc =>'The number of tries before success on each problem part.', non_html_notes => 'negative values indicate an incorrect problem', @@ -524,6 +527,7 @@ my @OutputDataOptions = grand_maximum => 1, summary_table => 1, maximum_row => 0, + ignore_weight => 1, shortdesc => 'Number of Problem Parts completed successfully.', longdesc => 'The Number of Problem Parts completed successfully and '. 'the maximum possible for each student', @@ -781,7 +785,8 @@ sub html_outputstudent { } else { ($performance,$performance_length,$score,$seq_max,$rawdata) = &student_performance_on_sequence($student,\%StudentsData, - $navmap,$seq,$show_links); + $navmap,$seq,$show_links, + $chosen_output->{ignore_weight}); } my $ratio=''; if ($chosen_output->{'every_problem'} && @@ -1144,9 +1149,11 @@ sub excel_initialize { ! defined($formula_data{$symb}->{'Excel:endcell'})) { $formula_data{$symb}->{'Excel:endcell'} = $formula_data{$symb}->{'Excel:startcell'}; } + + my $start = $formula_data{$symb}->{'Excel:startcell'}; + my $end = $formula_data{$symb}->{'Excel:endcell'}; $formula_data{$symb}->{'Excel:sum'}= $excel_sheet->store_formula - ('=SUM('.$formula_data{$symb}->{'Excel:startcell'}. - ':'.$formula_data{$symb}->{'Excel:endcell'}.')'); + ("=IF(COUNT($start\:$end),SUM($start\:$end),\"\")"); # Determine cell the score is held in $formula_data{$symb}->{'Excel:scorecell'} = &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell @@ -1231,7 +1238,7 @@ sub excel_initialize { $weight = 1; if ($chosen_output->{'scores'}) { $weight = &Apache::lonnet::EXT - ('resource.'.$part.'.weight',$resource->{'symb'}, + ('resource.'.$part.'.weight',$resource->symb, undef,undef,undef); if (!defined($weight) || ($weight eq '')) { $weight=1; @@ -1255,7 +1262,7 @@ sub excel_initialize { &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell($maximum_data_row,$formula_data{$symb}->{'Excel:endcol'})); $excel_sheet->repeat_formula($maximum_data_row,$cols_output++, $formula_data{$symb}->{'Excel:sum'},undef, - %replaceCells); + %replaceCells, %replaceCells); } elsif ($chosen_output->{'sequence_sum'}) { $excel_sheet->write($maximum_data_row,$cols_output++,$max); @@ -1405,14 +1412,16 @@ sub excel_outputstudent { } else { ($performance,$performance_length,$score,$seq_max,$rawdata) = &student_performance_on_sequence($student,\%StudentsData, - $navmap,$seq,'no'); + $navmap,$seq,'no', + $chosen_output->{ignore_weight}); } if ($chosen_output->{'every_problem'}) { if ($chosen_output->{'correct'}) { # only indiciate if each item is correct or not foreach my $value (@$rawdata) { - # nonzero means correct - $value = 1 if ($value > 0); + # positive means correct, 0 or negative means + # incorrect + $value = $value > 0 ? 1 : 0; $excel_sheet->write($rows_output,$cols_output++,$value); } } else { @@ -1438,7 +1447,7 @@ sub excel_outputstudent { # The undef is for the format $excel_sheet->repeat_formula($rows_output,$cols_output++, $formula_data{$symb}->{'Excel:sum'},undef, - %replaceCells); + %replaceCells, %replaceCells); } elsif ($chosen_output->{'sequence_sum'}) { if ($score eq ' ') { $cols_output++; @@ -1674,7 +1683,8 @@ sub csv_outputstudent { } else { ($performance,$performance_length,$score,$seq_max,$rawdata) = &student_performance_on_sequence($student,\%StudentsData, - $navmap,$seq,'no'); + $navmap,$seq,'no', + $chosen_output->{ignore_weight}); } if ($chosen_output->{'every_problem'}) { if ($chosen_output->{'correct'}) { @@ -1895,7 +1905,7 @@ Inputs: ####################################################### ####################################################### sub student_performance_on_sequence { - my ($student,$studentdata,$navmap,$seq,$links) = @_; + my ($student,$studentdata,$navmap,$seq,$links,$awarded_only) = @_; $links = 'no' if (! defined($links)); my $Str = ''; # final result string my ($score,$max) = (0,0); @@ -1909,11 +1919,14 @@ sub student_performance_on_sequence { my $resource_data = $studentdata->{$symb}; foreach my $part (@{$resource->parts()}) { $partscore = undef; - my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight', - $symb, - $student->{'domain'}, - $student->{'username'}, - $student->{'section'}); + my $weight; + if (!$awarded_only){ + $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight', + $symb, + $student->{'domain'}, + $student->{'username'}, + $student->{'section'}); + } if (!defined($weight) || ($weight eq '')) { $weight=1; }