[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm /interface/statistics lonstathelpers.pm lonstudentsubmissions.pm
raeburn
raeburn@source.lon-capa.org
Wed, 04 Aug 2010 01:56:07 -0000
This is a MIME encoded message
--raeburn1280886967
Content-Type: text/plain
raeburn Wed Aug 4 01:56:07 2010 EDT
Modified files:
/loncom/interface lonstatistics.pm
/loncom/interface/statistics lonstathelpers.pm
lonstudentsubmissions.pm
Log:
- Bug 6119.
- identifying information about user not displayed for problem parts
with type set to anonymous survey (with/without credit).
- all items must be either anonymous survey items, or named items
when displaying submissions for selected items.
- rows of students is randomized when showing rows of submission data
for anonymous survey items.
--raeburn1280886967
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100804015607.txt"
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.152 loncom/interface/lonstatistics.pm:1.153
--- loncom/interface/lonstatistics.pm:1.152 Mon May 3 16:41:51 2010
+++ loncom/interface/lonstatistics.pm Wed Aug 4 01:56:02 2010
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstatistics.pm,v 1.152 2010/05/03 16:41:51 www Exp $
+# $Id: lonstatistics.pm,v 1.153 2010/08/04 01:56:02 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -865,13 +865,15 @@
&Apache::loncoursedata::delete_caches($env{'requres.course.id'});
}
#
+ my $GoToPage = $env{'form.reportSelected'};
+ #
# Begin form output
$r->print('<form name="Statistics" ');
+ if ($GoToPage eq 'student_submission_reports') {
+ $r->print('onsubmit="return checkanon();" ');
+ }
$r->print('method="post" action="/adm/statistics">');
$r->rflush();
- #
- my $GoToPage = $env{'form.reportSelected'};
- #
$r->print('<input type="hidden" name="reportSelected" value="'.
$GoToPage.'" />');
if($GoToPage eq 'activitylog') {
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.62 loncom/interface/statistics/lonstathelpers.pm:1.63
--- loncom/interface/statistics/lonstathelpers.pm:1.62 Thu Jun 10 16:14:39 2010
+++ loncom/interface/statistics/lonstathelpers.pm Wed Aug 4 01:56:07 2010
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstathelpers.pm,v 1.62 2010/06/10 16:14:39 bisitz Exp $
+# $Id: lonstathelpers.pm,v 1.63 2010/08/04 01:56:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -224,7 +224,7 @@
####################################################
####################################################
sub MultipleProblemSelector {
- my ($navmap,$inputname,$formname)=@_;
+ my ($navmap,$inputname,$formname,$anoncounter)=@_;
my $cid = $env{'request.course.id'};
my $Str;
# Massage the input as needed.
@@ -259,7 +259,64 @@
}
</script>
END
- $Str .=
+ my $checkanonjs = <<"END";
+
+<script type="text/javascript" language="JavaScript">
+ function checkanon() {
+ return true;
+ }
+</script>
+
+END
+ if (ref($anoncounter) eq 'HASH') {
+ if (keys(%{$anoncounter}) > 0) {
+ my $anonwarning = &mt('Your selection includes both problems with and without anonymous submissions.').'\n'.&mt('You must select either only anonymous or only named problems.').'\n\n'.&mt('If a selection contains both anonymous and named parts, [_1]use the Anoymous/Named buttons to ensure selections will be either all anonymous [_1]or all named.','\n');
+ $checkanonjs = <<"END";
+
+<script type="text/javascript" language="JavaScript">
+ function checkanon() {
+ anoncount = 0;
+ namedcount = 0;
+ for (i=0; i<document.forms.$formname.elements.length; i++) {
+ ele = document.forms.$formname.elements[i];
+ if (ele.name == '$inputname') {
+ itemid = document.forms.$formname.elements[i].id;
+ if (document.forms.$formname.elements[i].checked) {
+ anonid = 'anonymous_'+itemid;
+ mixid = 'mixed_'+itemid;
+ anonele = document.getElementById(anonid);
+ mixele = document.getElementById(mixid);
+ if (anonele.value > 0) {
+ if (mixele.value == 'none') {
+ anoncount ++;
+ } else {
+ if (mixele.value == '0') {
+ if (mixele.checked) {
+ anoncount ++;
+ } else {
+ namedcount ++;
+ }
+ } else {
+ namedcount ++;
+ }
+ }
+ } else {
+ namedcount ++;
+ }
+ }
+ }
+ }
+ if (anoncount > 0 && namedcount > 0) {
+ alert("$anonwarning");
+ return false;
+ }
+ }
+</script>
+
+END
+ }
+ }
+ $Str .= $checkanonjs.
'<a href="javascript:checkall(true)">'.&mt('Select All').'</a>'.
(' 'x4).
'<a href="javascript:checkall(false)">'.&mt('Unselect All').'</a>';
@@ -290,9 +347,27 @@
$seq_id++,
$inputname));
} elsif ($curRes->is_problem) {
+ my $anonpart = 0;
+ my $namedpart = 0;
+ my @parts = @{$curRes->parts()};
+ if (ref($anoncounter) eq 'HASH') {
+ if (keys(%{$anoncounter}) > 0) {
+ my @parts = @{$curRes->parts()};
+ my $symb = $curRes->symb();
+ foreach my $part (@parts) {
+ if ((exists($anoncounter->{$symb."\0".$part})) ||
+ $curRes->is_anonsurvey($part)) {
+ $anonpart ++;
+ } else {
+ $namedpart ++
+ }
+ }
+ }
+ }
if (@Accumulator && $Accumulator[-1] ne '') {
&{$Accumulator[-1]}($curRes,
- exists($selected->{$curRes->symb}));
+ exists($selected->{$curRes->symb}),
+ $anonpart,$namedpart);
}
}
}
@@ -320,20 +395,45 @@
return
sub {
if (@_) {
- my ($res,$checked) = @_;
+ my ($res,$checked,$anonpart,$namedpart) = @_;
$target.='<tr><td><label>'.
'<input type="checkbox" name="'.$inputname.'" ';
if ($checked) {
$target .= 'checked="checked" ';
}
+ my $anon_id = $item_id;
$target .= 'id="'.$seq_id.':'.$item_id++.'" ';
+ my $esc_symb = &escape($res->symb);
$target.=
- 'value="'.&escape($res->symb).'" />'.
+ 'value="'.$esc_symb.'" />'.
' '.$res->compTitle.'</label>'.
(' 'x2).'<a target="preview" '.
'href="'.$res->link.'?symb='.
&escape($res->shown_symb).'">'.&mt('view').'</a>'.
- '</td></tr>'.$/;
+ '<input type="hidden" id="anonymous_'.$seq_id.':'.$anon_id.'" name="hidden_'.$seq_id.':'.$anon_id.'" value="'.$anonpart.'" />';
+ my $mixed = '<input type="hidden" id="mixed_'.$seq_id.':'.$anon_id.'" value="none" name="mixed_'.$seq_id.':'.$anon_id.'" />';
+ if ($anonpart) {
+ if ($namedpart) {
+ my $checknamed = '';
+ my $checkedanon = ' checked="checked"';
+ if ($env{'form.mixed_'.$seq_id.':'.$anon_id} eq $esc_symb) {
+ $checknamed = $checkedanon;
+ $checkedanon = '';
+ }
+ $mixed = ' ('.
+ &mt('Both anonymous and named submissions -- display: [_1]Anonymous [_2]Named[_3]',
+ '<span class="LC_nobreak"><label>'.
+ '<input type="radio" name="mixed_'.$seq_id.':'.$anon_id.
+ '" value="0" id="mixed_'.$seq_id.':'.$anon_id.'"'.$checkedanon.' />',
+ '</label></span>'.(' 'x2).' <span class="LC_nobreak">'.
+ '<label><input type="radio" name="mixed_'.$seq_id.':'.$anon_id.
+ '" value="symb_'.$esc_symb.'" id="named_'.$seq_id.':'.$anon_id.'"'.$checknamed.' />',
+ '</label></span>').')';
+ } else {
+ $target .= ' '.&mt('(Anonymous Survey)');
+ }
+ }
+ $target.= $mixed.'</td></tr>'.$/;
} else {
if (defined($target)) {
return { title => $title,
Index: loncom/interface/statistics/lonstudentsubmissions.pm
diff -u loncom/interface/statistics/lonstudentsubmissions.pm:1.59 loncom/interface/statistics/lonstudentsubmissions.pm:1.60
--- loncom/interface/statistics/lonstudentsubmissions.pm:1.59 Mon Apr 12 16:28:22 2010
+++ loncom/interface/statistics/lonstudentsubmissions.pm Wed Aug 4 01:56:07 2010
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentsubmissions.pm,v 1.59 2010/04/12 16:28:22 bisitz Exp $
+# $Id: lonstudentsubmissions.pm,v 1.60 2010/08/04 01:56:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -76,6 +76,10 @@
'<div class="LC_info">'.&mt('Loading student data...').'</div>');
$r->rflush();
#
+ my %anoncounter =
+ &Apache::lonnet::dump('nohist_anonsurveys',
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'});
if (exists($env{'form.problemchoice'}) &&
! exists($env{'form.SelectAnother'})) {
foreach my $button (@SubmitButtons) {
@@ -97,24 +101,82 @@
# Determine which problems we are to analyze
my @Symbs =
&Apache::lonstathelpers::get_selected_symbs('problemchoice');
- foreach my $selected (@Symbs) {
- $r->print('<input type="hidden" name="problemchoice" value="'.
- $selected.'" />'.$/);
+
+ # If there are multi-part problems with anonymous survey and named
+ # parts check if named was picked for display.
+ #
+ my %mixed_named;
+ foreach my $envkey (%env) {
+ if ($envkey =~ /^form\.mixed_(\d+:\d+)$/) {
+ my $item = $1;
+ if ($env{$envkey} =~ /^symb_(.+)$/) {
+ my $symb = &unescape($1);
+ if (ref($mixed_named{$symb}) eq 'ARRAY') {
+ push(@{$mixed_named{$symb}},$item);
+ } else {
+ @{$mixed_named{$symb}} = ($item);
+ }
+ }
+ }
}
#
# Get resource objects
my $navmap = Apache::lonnavmaps::navmap->new();
if (!defined($navmap)) {
+ foreach my $selected (@Symbs) {
+ $r->print('<input type="hidden" name="problemchoice" value="'.
+ &escape($selected).'" />'.$/);
+ if (ref($mixed_named{$selected}) eq 'ARRAY') {
+ foreach my $item (@{$mixed_named{$selected}}) {
+ $r->print('<input type="hidden" name="mixed_'.$item.'" value="'.&escape($selected).'" />'.$/);
+ }
+ }
+ }
$r->print('<div class="LC_error">'.&mt("Internal error").'</div>');
return;
}
my %already_seen;
- my @Problems;
+ my (@Problems,@anonProbs,@namedProbs,$show_named);
foreach my $symb (@Symbs) {
my $resource = $navmap->getBySymb($symb);
- push(@Problems,$resource);
+ my ($hasanon,$hasnamed);
+ if (ref($resource)) {
+ foreach my $partid (@{$resource->parts}) {
+ if (($anoncounter{$symb."\0".$partid}) || ($resource->is_anonsurvey($partid))) {
+ unless (exists($mixed_named{$symb})) {
+ $hasanon = 1;
+ }
+ } else {
+ $hasnamed = 1;
+ }
+ }
+ if ($hasanon) {
+ push(@anonProbs,$resource);
+ } elsif ($hasnamed) {
+ push(@namedProbs,$resource);
+ }
+ }
}
- #
+ if (@namedProbs > 0) {
+ @Problems = @namedProbs;
+ $show_named = 1;
+ } elsif (@anonProbs > 0) {
+ @Problems = @anonProbs;
+ }
+ foreach my $selected (@Symbs) {
+ $r->print('<input type="hidden" name="problemchoice" value="'.
+ &escape($selected).'" />'.$/);
+ if (ref($mixed_named{$selected}) eq 'ARRAY') {
+ foreach my $item (@{$mixed_named{$selected}}) {
+ $r->print('<input type="hidden" name="mixed_'.$item.'" value="'.&escape($selected).'" />'.$/);
+ }
+ }
+ }
+ # If these are to be anonymized, do a random shuffle of @Students.
+ unless ($show_named) {
+ &array_shuffle(\@Students);
+ }
+ #
$r->print('<h4>'.
&Apache::lonstatistics::section_and_enrollment_description().
'</h4>');
@@ -131,11 +193,11 @@
}
}
if ($env{'form.output'} eq 'excel') {
- &prepare_excel_output($r,\@Problems,\@Students);
+ &prepare_excel_output($r,\@Problems,\@Students,\%anoncounter,$show_named);
} elsif ($env{'form.output'} eq 'csv') {
- &prepare_csv_output($r,\@Problems,\@Students);
+ &prepare_csv_output($r,\@Problems,\@Students,\%anoncounter,$show_named);
} else {
- &prepare_html_output($r,\@Problems,\@Students);
+ &prepare_html_output($r,\@Problems,\@Students,\%anoncounter,$show_named);
}
}
$r->print('<hr />');
@@ -150,23 +212,40 @@
&mt('Please select problems and use the [_1]Prepare Report[_2] button to continue.','<b>','</b>').
'</p>');
$r->print(&Apache::lonstathelpers::MultipleProblemSelector
- (undef,'problemchoice','Statistics'));
+ (undef,'problemchoice','Statistics',\%anoncounter));
}
}
+sub array_shuffle {
+ my $array = shift;
+ return unless (ref($array) eq 'ARRAY');
+ my $i = scalar(@$array);
+ my $j;
+ foreach my $item (@$array) {
+ --$i;
+ $j = int(rand($i+1));
+ next if($i == $j);
+ @$array [$i,$j] = @$array[$j,$i];
+ }
+ return @$array;
+}
+
##
## get_extra_response_headers
##
sub get_extra_response_headers {
+ my ($show_named) = @_;
my @extra_resp_headers;
if ($env{'form.correctans'} eq 'true') {
push(@extra_resp_headers,'Correct');
- }
- if ($env{'form.prob_status'} eq 'true') {
- push(@extra_resp_headers,'Award Detail');
- push(@extra_resp_headers,'Time');
- push(@extra_resp_headers,'Attempt');
- push(@extra_resp_headers,'Awarded');
+ }
+ if ($show_named) {
+ if ($env{'form.prob_status'} eq 'true') {
+ push(@extra_resp_headers,'Award Detail');
+ push(@extra_resp_headers,'Time');
+ push(@extra_resp_headers,'Attempt');
+ push(@extra_resp_headers,'Awarded');
+ }
}
return @extra_resp_headers;
}
@@ -211,7 +290,7 @@
#########################################################
#########################################################
sub prepare_html_output {
- my ($r,$problems,$students) = @_;
+ my ($r,$problems,$students,$anoncounter,$show_named) = @_;
my $c = $r->connection();
#
# Set a flag for the case when there is just one problem
@@ -222,14 +301,17 @@
}
#
# Compute the number of columns per response
- my @extra_resp_headers = &get_extra_response_headers();
+ my @extra_resp_headers = &get_extra_response_headers($show_named);
#
# Create the table header
- my @student_columns = @Apache::lonstatistics::SelectedStudentData;
- foreach (@student_columns) {
- if($_ eq 'all') {
- @student_columns = ('fullname','username','domain','id','section','status','groups','comments');
+ my @student_columns;
+ if ($show_named) {
+ @student_columns = @Apache::lonstatistics::SelectedStudentData;
+ if (grep(/^all$/,@student_columns)) {
+ @student_columns = qw(fullname username domain id section status groups comments);
}
+ } else {
+ @student_columns = ('username');
}
#
my %headers;
@@ -247,13 +329,21 @@
foreach my $prob (@$problems) {
my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);
$problem_analysis{$prob->src}=\%analysis;
+ my $symb = $prob->symb();
#
my $prob_span = 0;
my $single_part = 0;
if (scalar(@{$prob->parts}) == 1) {
$single_part = 1;
}
+ my $shown_parts = 0;
foreach my $partid (@{$prob->parts}) {
+ if (($prob->is_anonsurvey($partid)) || ($anoncounter->{$symb."\0".$partid})) {
+ next if ($show_named);
+ } else {
+ next unless ($show_named);
+ }
+ $shown_parts ++;
my $part_span = 0;
my $responses = [$prob->responseIds($partid)];
my $resptypes = [$prob->responseType($partid)];
@@ -294,6 +384,7 @@
}
$prob_span += $part_span;
}
+ next if (!$shown_parts);
my $title = $prob->compTitle;
if ($prob_span > 0) {
$headers{'problem'}.= qq{<th colspan="$prob_span">$title</th>};
@@ -330,17 +421,21 @@
$count = 0;
}
last if ($c->aborted());
- foreach my $field (@student_columns) {
- $student_row_data .= '<td valign="top">';
- # handle comments like in lonstudentassessment.pm
- if($field eq 'comments') {
- $student_row_data .=
+ if ($show_named) {
+ foreach my $field (@student_columns) {
+ $student_row_data .= '<td valign="top">';
+ # handle comments like in lonstudentassessment.pm
+ if($field eq 'comments') {
+ $student_row_data .=
'<a href="/adm/'.$student->{'domain'}.'/'.
$student->{'username'}.'/'.'aboutme#coursecomment">'.&mt('Comments').'</a>';
- } else {
- $student_row_data .= $student->{$field};
+ } else {
+ $student_row_data .= $student->{$field};
+ }
+ $student_row_data .= '</td>';
}
- $student_row_data .= '</td>';
+ } else {
+ $student_row_data = '<td valign="top" colspan="'.$student_column_count.'">'.&mt('Anonymized').'</td>';
}
#
# Figure out what it is we need to output for this student
@@ -348,8 +443,14 @@
my %prob_data;
my $maxrow;
foreach my $prob (@$problems) {
- $prob_data{$prob->symb}={};
+ my $symb = $prob->symb;
+ $prob_data{$symb}={};
foreach my $partid (@{$prob->parts}) {
+ if (($prob->is_anonsurvey($partid)) || ($anoncounter->{$symb."\0".$partid})) {
+ next if ($show_named);
+ } else {
+ next unless ($show_named);
+ }
my @responses = $prob->responseIds($partid);
my @response_type = $prob->responseType($partid);
for (my $i=0;$i<=$#responses;$i++) {
@@ -639,19 +740,26 @@
#########################################################
#########################################################
sub prepare_excel_output {
- my ($r,$Problems,$Students) = @_;
+ my ($r,$Problems,$Students,$anoncounter,$show_named) = @_;
my $c = $r->connection();
#
#
# Determine the number of columns in the spreadsheet
my $columncount = 3; # username, domain, id
- my @extra_resp_headers = &get_extra_response_headers();
+ my @extra_resp_headers = &get_extra_response_headers($show_named);
my $lastprob;
my %problem_analysis;
foreach my $prob (@$Problems) {
+ my $symb = $prob->symb();
my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);
$problem_analysis{$prob->src}=\%analysis;
foreach my $partid (@{$prob->parts}) {
+ if (($prob->is_anonsurvey($partid)) || ($anoncounter->{$symb."\0".$partid})) {
+ next if ($show_named);
+ } else {
+ next unless ($show_named);
+ }
+
my $responses = [$prob->responseIds($partid)];
my $resptypes = [$prob->responseType($partid)];
for (my $i=0;$i<scalar(@$responses);$i++) {
@@ -669,8 +777,10 @@
if ($columncount > 255) {
$r->print('<h1>'.&mt('Unable to complete request').'</h1>'.$/.
'<p>'.&mt('LON-CAPA is unable to produce your Excel spreadsheet because your selections will result in more than 255 columns. Excel allows only 255 columns in a spreadsheet.').'</p>'.$/.
- '<p>'.&mt('Consider selecting fewer problems to generate reports on, or reducing the number of items per problem. Or use HTML or CSV output.').'</p>'.$/.
- '<p>'.&mt('The last problem that will fit in the current spreadsheet is [_1].',$lastprob->compTitle).'</p>');
+ '<p>'.&mt('Consider selecting fewer problems to generate reports on, or reducing the number of items per problem. Or use HTML or CSV output.').'</p>'.$/);
+ if (ref($lastprob)) {
+ $r->print('<p>'.&mt('The last problem that will fit in the current spreadsheet is [_1].',$lastprob->compTitle).'</p>');
+ }
$r->rflush();
return;
}
@@ -709,7 +819,12 @@
$worksheet->write($partid_row,0,'Part ID',$format->{'bold'});
$worksheet->write($respid_row,0,'Response ID',$format->{'bold'});
# Student headers
- my @StudentColumns = ('username','domain','id','section');
+ my @StudentColumns;
+ if ($show_named) {
+ @StudentColumns = qw(username domain id section);
+ } else {
+ @StudentColumns = qw(username);
+ }
foreach (@StudentColumns) {
$worksheet->write($header_row,$cols_output++,ucfirst($_),
$format->{'bold'});
@@ -718,9 +833,15 @@
my %start_col;
foreach my $prob (@$Problems) {
my $title = $prob->compTitle;
+ my $symb = $prob->symb();
$worksheet->write($title_row,$cols_output,
$title,$format->{'h3'});
foreach my $partid (@{$prob->parts}) {
+ if (($prob->is_anonsurvey($partid)) || ($anoncounter->{$symb."\0".$partid})) {
+ next if ($show_named);
+ } else {
+ next unless ($show_named);
+ }
$worksheet->write($partid_row,$cols_output,
$prob->part_display($partid));
my $responses = [$prob->responseIds($partid)];
@@ -757,12 +878,23 @@
$cols_output = 0;
my $student_row = $max_row;
foreach my $field (@StudentColumns) {
- $worksheet->write($student_row,$cols_output++,
- $student->{$field});
+ if ($show_named) {
+ $worksheet->write($student_row,$cols_output++,
+ $student->{$field});
+ } else {
+ $worksheet->write($student_row,$cols_output++,
+ &mt('Anonymized'));
+ }
}
my $last_student_col = $cols_output-1;
foreach my $prob (@$Problems) {
+ my $symb = $prob->symb();
foreach my $partid (@{$prob->parts}) {
+ if (($prob->is_anonsurvey($partid)) || ($anoncounter->{$symb."\0".$partid})) {
+ next if ($show_named);
+ } else {
+ next unless ($show_named);
+ }
my @Response = $prob->responseIds($partid);
my @ResponseType = $prob->responseType($partid);
for (my $i=0;$i<=$#Response;$i++) {
@@ -813,8 +945,13 @@
for (my $row = $student_row+1;$row<$max_row;$row++) {
my $cols = 0;
foreach my $field (@StudentColumns) {
- $worksheet->write($row,$cols++,
- $student->{$field});
+ if ($show_named) {
+ $worksheet->write($row,$cols++,
+ $student->{$field});
+ } else {
+ $worksheet->write($row,$cols++,
+ &mt('Anonymized'));
+ }
}
}
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
@@ -924,7 +1061,7 @@
#########################################################
#########################################################
sub prepare_csv_output {
- my ($r,$problems,$students) = @_;
+ my ($r,$problems,$students,$anoncounter,$show_named) = @_;
my $c = $r->connection();
#
$r->print('<h2>'.
@@ -956,10 +1093,16 @@
}
#
# Compute the number of columns per response
- my @extra_resp_headers = &get_extra_response_headers();
+ my @extra_resp_headers = &get_extra_response_headers($show_named);
#
# Create the table header
my @student_columns = ('username','domain','id','section');
+ if ($show_named) {
+ @student_columns = qw(username domain id section);
+ } else {
+ @student_columns = qw(username);
+ }
+ my $student_column_count = scalar(@student_columns);
#
my %headers;
push(@{$headers{'student'}},@student_columns);
@@ -973,10 +1116,16 @@
my %start_col;
my $max_column = scalar(@student_columns);
foreach my $prob (@$problems) {
+ my $symb = $prob->symb();
my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src);
$problem_analysis{$prob->src}=\%analysis;
$headers{'problem'}->[$max_column] = $prob->compTitle;
foreach my $partid (@{$prob->parts}) {
+ if (($prob->is_anonsurvey($partid)) || ($anoncounter->{$symb."\0".$partid})) {
+ next if ($show_named);
+ } else {
+ next unless ($show_named);
+ }
$headers{'part'}->[$max_column] = $prob->part_display($partid);
my $responses = [$prob->responseIds($partid)];
my $resptypes = [$prob->responseType($partid)];
@@ -1010,7 +1159,13 @@
last if ($c->aborted());
my @rows;
foreach my $prob (@$problems) {
+ my $symb = $prob->symb;
foreach my $partid (@{$prob->parts}) {
+ if (($prob->is_anonsurvey($partid)) || ($anoncounter->{$symb."\0".$partid})) {
+ next if ($show_named);
+ } else {
+ next unless ($show_named);
+ }
my @responses = $prob->responseIds($partid);
my @response_type = $prob->responseType($partid);
for (my $i=0;$i<=$#responses;$i++) {
@@ -1048,10 +1203,16 @@
}
}
foreach my $row (@rows) {
- print $outputfile '"'.join('","',
- map { $student->{$_}; }
- @student_columns).'"';
- for (my $i=scalar(@student_columns);$i<$max_column;$i++) {
+ my $student_row_data = '';
+ if ($show_named) {
+ $student_row_data = '"'.join('","',
+ map { $student->{$_}; }
+ @student_columns).'"';
+ } else {
+ $student_row_data = '"'.&mt('Anonymized').'"';
+ }
+ print $outputfile $student_row_data;
+ for (my $i=$student_column_count;$i<$max_column;$i++) {
my $value = &Apache::loncommon::csv_translate($row->[$i]);
$value ||='';
print $outputfile ',"'.$value.'"';
--raeburn1280886967--