--- loncom/interface/statistics/longradinganalysis.pm 2006/02/14 16:05:46 1.1
+++ loncom/interface/statistics/longradinganalysis.pm 2006/02/14 22:12:46 1.3
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: longradinganalysis.pm,v 1.1 2006/02/14 16:05:46 albertel Exp $
+# $Id: longradinganalysis.pm,v 1.3 2006/02/14 22:12:46 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -34,7 +34,8 @@ use Apache::loncoursedata();
use Apache::lonstatistics;
use Apache::lonlocal;
use Apache::lonstathelpers();
-use Apache::lonstudentsubmissions();
+use Spreadsheet::WriteExcel;
+use Spreadsheet::WriteExcel::Utility();
use HTML::Entities();
use Time::Local();
use Data::Dumper;
@@ -158,31 +159,125 @@ sub task_analysis {
my %data = &Apache::lonnet::restore($problem->symb(),
$env{'request.course.id'},
$sdom,$sname);
+ my $last_grader;
foreach my $ver (0..$data{'version'}) {
if (exists($data{"$ver:resource.0.regrader"})
&& $data{"$ver:resource.0.regrader"} =~ /\S/) {
- $graders{$data{"$ver:resource.0.regrader"}}++;
+ $last_grader=$data{"$ver:resource.0.regrader"};
}
+ if (exists($data{"$ver:resource.0.version"})
+ && $last_grader =~ /\S/) {
+ $graders{$last_grader}++;
+ }
+ }
+ if ($last_grader =~ /\S/) {
+ $graders{$last_grader}++;
}
+
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
&mt('last student'));
}
+
+ my @output;
+ foreach my $grader (sort(keys(%graders))) {
+ my ($gname,$gdom) = split(/(?:\:|\@)/,$grader,2);
+ my $name = &Apache::loncommon::plainname($gname,$gdom);
+ push(@output,[$name,$gname."@".$gdom,$graders{$grader}]);
+ }
+
if ($env{'form.output'} eq 'csv') {
+ my ($outputfile,$filename) = &init_csv_output($r);
+ foreach my $line (@output) {
+ print $outputfile
+ ('"'.join(q{","},
+ map {&Apache::loncommon::csv_translate($_)} @{$line})
+ .'"'."\n");
+ }
+ close($outputfile);
+ $r->print('
'.
+ ''.&mt('Your csv file.')."\n");
} elsif ($env{'form.output'} eq 'excel') {
+ my ($excel_workbook,$excel_sheet,$filename,$format,$rows_output) =
+ &init_excel_output($r);
+ foreach my $line (@output) {
+ my $cols_output = 0;
+ foreach my $item (@{ $line }) {
+ $excel_sheet->write($rows_output,$cols_output++,$item);
+ }
+ $rows_output++;
+ }
+ # Write the excel file
+ $excel_workbook->close();
+
+ # Tell the user where to get their excel file
+ $r->print('
'.
+ ''.
+ &mt('Your Excel spreadsheet.').''."\n");
} else {
$r->print('
$link ($grader) | $graders{$grader} |
Name (username) | Grades Assigned |
---|---|
%s (%s) | %s |