[system] / trunk / webwork2 / lib / WeBWorK / ContentGenerator / Instructor / Scoring.pm Repository:
ViewVC logotype

Diff of /trunk/webwork2/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 3245 Revision 3252
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System 2# WeBWorK Online Homework Delivery System
3# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm,v 1.41 2005/05/27 16:34:29 apizer Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/Scoring.pm,v 1.42 2005/05/27 17:41:27 apizer Exp $
5# 5#
6# This program is free software; you can redistribute it and/or modify it under 6# This program is free software; you can redistribute it and/or modify it under
7# the terms of either: (a) the GNU General Public License as published by the 7# the terms of either: (a) the GNU General Public License as published by the
8# Free Software Foundation; either version 2, or (at your option) any later 8# Free Software Foundation; either version 2, or (at your option) any later
9# version, or (b) the "Artistic License" which comes with this package. 9# version, or (b) the "Artistic License" which comes with this package.
463 $scoringData[4][$totalsColumn+1] = ""; 463 $scoringData[4][$totalsColumn+1] = "";
464 $scoringData[5][$totalsColumn+1] = '100'; 464 $scoringData[5][$totalsColumn+1] = '100';
465 $scoringData[6][$totalsColumn+1] = "index" ; 465 $scoringData[6][$totalsColumn+1] = "index" ;
466 } 466 }
467 for (my $user = 0; $user < @sortedUserIDs; $user++) { 467 for (my $user = 0; $user < @sortedUserIDs; $user++) {
468 $scoringData[7+$user][$totalsColumn] = sprintf("%4.1f",$userStatusTotals{$user}); 468 $scoringData[7+$user][$totalsColumn] = sprintf("%.1f",$userStatusTotals{$user});
469 $scoringData[7+$user][$totalsColumn+1] = sprintf("%4.0f",100*$userSuccessIndex{$user}) if $scoringItems->{successIndex}; 469 $scoringData[7+$user][$totalsColumn+1] = sprintf("%.0f",100*$userSuccessIndex{$user}) if $scoringItems->{successIndex};
470 } 470 }
471 } 471 }
472 $WeBWorK::timer->continue("End set $setID") if defined($WeBWorK::timer); 472 $WeBWorK::timer->continue("End set $setID") if defined($WeBWorK::timer);
473 return @scoringData; 473 return @scoringData;
474} 474}
500 for( my $j = $start_column;$j<=$last_column;$j+= $index_increment) { 500 for( my $j = $start_column;$j<=$last_column;$j+= $index_increment) {
501 my $score = $r_totals->[$i]->[$j]; 501 my $score = $r_totals->[$i]->[$j];
502 $studentTotal += ($score =~/^\s*[\d\.]+\s*$/)? $score : 0; 502 $studentTotal += ($score =~/^\s*[\d\.]+\s*$/)? $score : 0;
503 503
504 } 504 }
505 $scoringData[$i][0] =sprintf("%4.1f",$studentTotal); 505 $scoringData[$i][0] =sprintf("%.1f",$studentTotal);
506 $scoringData[$i][1] =($totalPoints) ?sprintf("%4.1f",100*$studentTotal/$totalPoints) : 0; 506 $scoringData[$i][1] =($totalPoints) ?sprintf("%.1f",100*$studentTotal/$totalPoints) : 0;
507 } 507 }
508 $scoringData[0] = ['','']; 508 $scoringData[0] = ['',''];
509 $scoringData[1] = ['summary', '%score']; 509 $scoringData[1] = ['summary', '%score'];
510 $scoringData[2] = ['','']; 510 $scoringData[2] = ['',''];
511 $scoringData[3] = ['','']; 511 $scoringData[3] = ['',''];
593 $lengths[$column] = 0 unless defined $lengths[$column]; 593 $lengths[$column] = 0 unless defined $lengths[$column];
594 $lengths[$column] = length $csv[$row][$column] if defined($csv[$row][$column]) and length $csv[$row][$column] > $lengths[$column]; 594 $lengths[$column] = length $csv[$row][$column] if defined($csv[$row][$column]) and length $csv[$row][$column] > $lengths[$column];
595 } 595 }
596 } 596 }
597 597
598 # Before writing a new totals file, we back up an existing totals file keeping any previous backups.
599 # We do not backup any other type of scoring files (e.g. ful or scr).
600
601 if (($filename =~ m|(.*)/(.*_totals)\.csv$|) and (-e $filename)) {
602 my $scoringDir = $1;
603 my $short_filename = $2;
604 my $i=1;
605 while(-e "${scoringDir}/${short_filename}_bak$i.csv") {$i++;} #don't overwrite existing backups
606 my $bakFileName ="${scoringDir}/${short_filename}_bak$i.csv";
607 rename $filename, $bakFileName or warn "Unable to rename $filename to $bakFileName";
608 }
609
598 open my $fh, ">", $filename or warn "Unable to open $filename for writing"; 610 open my $fh, ">", $filename or warn "Unable to open $filename for writing";
599 foreach my $row (@csv) { 611 foreach my $row (@csv) {
600 my @rowPadded = (); 612 my @rowPadded = ();
601 foreach (my $column = 0; $column < @$row; $column++) { 613 foreach (my $column = 0; $column < @$row; $column++) {
602 push @rowPadded, $self->pad($row->[$column], $lengths[$column] + 1); 614 push @rowPadded, $self->pad($row->[$column], $lengths[$column] + 1);

Legend:
Removed from v.3245  
changed lines
  Added in v.3252

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9