[system] / trunk / webwork / system / scripts / alternateScoreProbSet.pl Repository:
ViewVC logotype

Annotation of /trunk/webwork/system/scripts/alternateScoreProbSet.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1533 - (view) (download) (as text)

1 : sh002i 1533 #!/usr/bin/env perl
2 : sam 2
3 :     ####################################################################
4 :     # Copyright @ 1995-1998 University of Rochester
5 :     # All Rights Reserved
6 :     ####################################################################
7 :    
8 : sam 70 BEGIN {
9 :     my $useLibDir = '.';
10 :     if ($0 =~ m|^(/.*)/|) { $useLibDir = $1; }
11 :     elsif ($0 =~ m|^(\..*)/|) { $useLibDir = $1; }
12 :     elsif ($0 =~ m|^(.+)/|) { $useLibDir = "./$1"; }
13 :     unshift @INC, $useLibDir;
14 :     }
15 : sam 2
16 : sam 70 use webworkInit; # WeBWorKInitLine
17 : sam 2 use Global;
18 :     use TimeLocal;
19 :     use strict;
20 :    
21 :     # This file is alternateScoreProbSet.pl
22 :    
23 :     # Call with command arguments of the form: className set5.def
24 :    
25 :     if (@ARGV != 2) {
26 :     print "\nSyntax is alternateScoreProbSet.pl courseID setDefinitionFile.ext \n";
27 :     print " (e.g. alternateScoreProbSet.pl MTH140A set7.def ) \n\n";
28 :     exit(0);
29 :     }
30 :    
31 :    
32 :     # CAUTION: FOR THIS SCRIPT TO WORK CORRECTLTY, ALL STUDENTS
33 :     # MUST HAVE BEEN ASSIGNED THE SAME NUMBER OF PROBLREMS
34 :    
35 :    
36 :     my $classID = $ARGV[0];
37 :    
38 :     my $scriptDirectory = &getWebworkScriptDirectory();
39 :     &getCourseEnvironment("$classID");
40 :     my $databaseDirectory = &getCourseDatabaseDirectory();
41 :     my $templateDirectory = &getCourseTemplateDirectory();
42 :     my $scoringDirectory = &getCourseScoringDirectory();
43 :    
44 :     my $DAT = &getDat();
45 :    
46 :     require "${scriptDirectory}$Global::DBglue_pl";
47 : apizer 416 require "${scriptDirectory}$Global::classlist_DBglue_pl";
48 : sam 2 require "${scriptDirectory}$Global::FILE_pl";
49 :     require "${scriptDirectory}$Global::SCRtools_pl";
50 :    
51 :    
52 :     my $fileName="${templateDirectory}$ARGV[1]";
53 :    
54 :     print STDERR "Getting set definition from file:$fileName \n";
55 :    
56 : apizer 416 my ($setNumber,$setHeaderFileName,$probHeaderFileName,$dueDate,$openDate,$answerDate,$problemListref,$problemValueListref,$problemAttemptLimitListref,$problemContinuationFlagListRef)
57 : sam 2 = &readSetDef($fileName);
58 :     my @problemList = @$problemListref;
59 :    
60 :     $dueDate = &unformatDateAndTime($dueDate); ##just in case someone uses the old format
61 :     $dueDate = &formatDateAndTime($dueDate); ##dueDate is now in the form 4/15/96 at 2:00 AM
62 :    
63 :     my $dueTime=$dueDate;
64 :     $dueDate=~s|^\s*||;
65 :     $dueDate=~s|\s*at.*$||;
66 :     $dueTime=~s|^.*at\s*||;
67 :     $dueTime=~s|\s*$||;
68 :    
69 :     print "$dueDate\n";
70 :     print "$dueTime\n";
71 :    
72 :     &get_raw_scores('scofiles', $setNumber, $dueDate, $dueTime,$problemListref,$problemValueListref);
73 :    
74 : apizer 416 my $fullTotalsFileName = "${scoringDirectory}${classID}_totals.${DAT}";
75 : sam 2 my $fullScrFileName = "${scoringDirectory}s${setNumber}scr.${DAT}";
76 :     my $noOfProbs = @problemList;
77 :    
78 :     print "\n Number of Probs is $noOfProbs\n";
79 :    
80 :     print "\n\nDo you want to total the scores in the score file for this set,\n";
81 :     print "$fullScrFileName, \n";
82 :     print "and append these totals to the cummulative totals file,\n";
83 :     print "$fullTotalsFileName, \n\n";
84 :     print "We recommend that you do\? (Y or N)\n";
85 :    
86 :     my $ans;
87 :    
88 :     $ans=<STDIN>;
89 :     chomp($ans);
90 :     unless (($ans eq "Y") || ($ans eq "y")) {exit 0;}
91 :    
92 : apizer 416 my $totalsFileName = "${classID}_totals";
93 : sam 2 my $scrFileName = "s${setNumber}scr";
94 :    
95 :     &total_score($scrFileName,$setNumber);
96 :    
97 :     unless (-e "$fullTotalsFileName")
98 :     {
99 :     my $gid = $Global::numericalGroupID;
100 :     $gid = $Global::numericalGroupID; ## hack to remove warning message about $Global::numericalGroupID used only once
101 :     &createFile("$fullTotalsFileName", $Global::scoring_files_permission, $gid);
102 :     }
103 :    
104 :     &append_score_db($totalsFileName,$scrFileName);
105 :    
106 :     &delete_columns ($totalsFileName, -$noOfProbs-1, -2, 0);
107 :    
108 :    

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9