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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 03 Apr 2007 20:10:41 -0000


albertel		Tue Apr  3 16:10:41 2007 EDT

  Modified files:              
    /loncom/interface/statistics	lonsurveyreports.pm 
  Log:
  - BUG#5228 - show all foils in survey results, evne unpicked ones
  
  
Index: loncom/interface/statistics/lonsurveyreports.pm
diff -u loncom/interface/statistics/lonsurveyreports.pm:1.14 loncom/interface/statistics/lonsurveyreports.pm:1.15
--- loncom/interface/statistics/lonsurveyreports.pm:1.14	Fri Aug 18 11:15:38 2006
+++ loncom/interface/statistics/lonsurveyreports.pm	Tue Apr  3 16:10:41 2007
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonsurveyreports.pm,v 1.14 2006/08/18 15:15:38 raeburn Exp $
+# $Id: lonsurveyreports.pm,v 1.15 2007/04/03 20:10:41 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -264,6 +264,7 @@
                     $data->{'foil_values'}->{$value}++;
                     if (! exists($data->{'map'}->{$value})) {
                         $data->{'map'}->{$value} = $foil;
+                        $data->{'map_fv'}->{$foil} = $value;
                     }
                 } else {
                     # Variable stuff (essays, raw numbers, strings) go here
@@ -404,7 +405,7 @@
                 $worksheet->write_row($rows_output++,0,
                                       \@rowdata,$format->{'h4'});
                 #
-                my @foils = sort(keys(%{$data->{'foil_responses'}}));
+		my @foils = sort(keys(%{$respdata->{'_Foils'}}));
                 foreach my $foilid (@foils) {
                     my $foil_count = $data->{'foil_count'}->{$foilid};
                     my $foiltext = $respdata->{'_Foils'}->{$foilid}->{'text'};
@@ -432,9 +433,10 @@
                 my @rowdata = ('Foil Name','Foil Text','Frequency');
                 $worksheet->write_row($rows_output++,0,
                                       \@rowdata,$format->{'h4'});
-                foreach my $value (sort(keys(%{$data->{'foil_values'}}))) {
+		my @foils = sort(keys(%{$respdata->{'_Foils'}}));
+                foreach my $foilid (@foils) {
                     undef(@rowdata);
-                    my $foilid = $data->{'map'}->{$value};
+                    my $value = $data->{'map_fv'}->{$foilid};
                     push(@rowdata,$respdata->{'_Foils'}->{$foilid}->{'name'});
                     push(@rowdata,$respdata->{'_Foils'}->{$foilid}->{'text'});
                     push(@rowdata,$data->{'foil_values'}->{$value});
@@ -512,7 +514,7 @@
                                        &mt('Option'),
                                        &mt('Frequency'),
                                        &mt('Percent'))).'</th></tr>';
-                my @foils = sort(keys(%{$data->{'foil_responses'}}));
+		my @foils = sort(keys(%{$ProblemData->{$partid.'.'.$respid}->{'_Foils'}}));
                 foreach my $foilid (@foils) {
                     my $prob_data = $ProblemData->{$partid.'.'.$respid};
                     my $foil_count = $data->{'foil_count'}->{$foilid};
@@ -544,9 +546,11 @@
                 my $total = $data->{'_count'};
                 my $sum = 0;
                 my $tmp;
-                foreach my $value (sort(keys(%{$data->{'foil_values'}}))) {
+		my @foils = sort(keys(%{$ProblemData->{$partid.'.'.$respid}
+					            ->{'_Foils'}}));
+                foreach my $foilid (@foils) {
+                    my $value = $data->{'map_fv'}->{$foilid};
                     my $count = $data->{'foil_values'}->{$value};
-                    my $foilid = $data->{'map'}->{$value};
                     my $foiltext = $ProblemData->{$partid.'.'.$respid}->{'_Foils'}->{$foilid}->{'text'};
                     my $foilname = $ProblemData->{$partid.'.'.$respid}->{'_Foils'}->{$foilid}->{'name'};
                     $tmp .= '<tr>'.