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