[LON-CAPA-cvs] cvs: loncom /interface/statistics lonstudentassessment.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Sun, 29 Jan 2006 19:39:04 -0000


bowersj2		Sun Jan 29 14:39:04 2006 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  Fix bug 4490; parts correct works when weight for the problem = 0;
  
  
  
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.128 loncom/interface/statistics/lonstudentassessment.pm:1.129
--- loncom/interface/statistics/lonstudentassessment.pm:1.128	Sat Jan 28 14:25:59 2006
+++ loncom/interface/statistics/lonstudentassessment.pm	Sun Jan 29 14:39:03 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.128 2006/01/28 19:25:59 bowersj2 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 @@
        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 @@
        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 @@
        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 @@
        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 @@
         } 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'} && 
@@ -1407,7 +1412,8 @@
         } 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'}) {
@@ -1677,7 +1683,8 @@
         } 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'}) {
@@ -1898,7 +1905,7 @@
 #######################################################
 #######################################################
 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);
@@ -1912,11 +1919,14 @@
         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;
             }