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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (download) (as text) (annotate)
Mon Jun 25 18:20:05 2001 UTC (18 years, 5 months ago) by sam
File size: 3268 byte(s)
Removed unneeded scripts (as per discussion with gage, apizer). Added
BEGIN-block method for library inclusion to command-line scripts.

    1 #!/usr/local/bin/webwork-perl
    2 
    3 ####################################################################
    4 # Copyright @ 1995-1998 University of Rochester
    5 # All Rights Reserved
    6 ####################################################################
    7 
    8 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 
   16 use webworkInit; # WeBWorKInitLine
   17 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 require "${scriptDirectory}$Global::FILE_pl";
   48 require "${scriptDirectory}$Global::SCRtools_pl";
   49 
   50 
   51 my $fileName="${templateDirectory}$ARGV[1]";
   52 
   53 print STDERR "Getting set definition from file:$fileName \n";
   54 
   55 my ($setNumber,$setHeaderFileName,$probHeaderFileName,$dueDate,$openDate,$answerDate,$problemListref,$problemValueListref,$problemAttemptLimitListref)
   56   = &readSetDef($fileName);
   57 my @problemList = @$problemListref;
   58 
   59 $dueDate = &unformatDateAndTime($dueDate);  ##just in case someone uses the old format
   60 $dueDate = &formatDateAndTime($dueDate);  ##dueDate is now in the form 4/15/96 at 2:00 AM
   61 
   62 my $dueTime=$dueDate;
   63 $dueDate=~s|^\s*||;
   64 $dueDate=~s|\s*at.*$||;
   65 $dueTime=~s|^.*at\s*||;
   66 $dueTime=~s|\s*$||;
   67 
   68 print "$dueDate\n";
   69 print "$dueTime\n";
   70 
   71 &get_raw_scores('scofiles', $setNumber, $dueDate, $dueTime,$problemListref,$problemValueListref);
   72 
   73 my $fullTotalsFileName = "${scoringDirectory}${classID}totals.${DAT}";
   74 my $fullScrFileName = "${scoringDirectory}s${setNumber}scr.${DAT}";
   75 my $noOfProbs = @problemList;
   76 
   77 print "\n Number of Probs is $noOfProbs\n";
   78 
   79 print "\n\nDo you want to total the scores in the score file for this set,\n";
   80 print "$fullScrFileName, \n";
   81 print "and append these totals to the cummulative totals file,\n";
   82 print "$fullTotalsFileName, \n\n";
   83 print "We recommend that you do\? (Y or N)\n";
   84 
   85 my $ans;
   86 
   87 $ans=<STDIN>;
   88 chomp($ans);
   89 unless (($ans eq "Y") || ($ans eq "y")) {exit 0;}
   90 
   91 my $totalsFileName = "${classID}totals";
   92 my $scrFileName = "s${setNumber}scr";
   93 
   94 &total_score($scrFileName,$setNumber);
   95 
   96 unless (-e "$fullTotalsFileName")
   97   {
   98     my $gid = $Global::numericalGroupID;
   99     $gid = $Global::numericalGroupID;    ## hack to remove warning message about $Global::numericalGroupID used only once
  100   &createFile("$fullTotalsFileName", $Global::scoring_files_permission, $gid);
  101   }
  102 
  103 &append_score_db($totalsFileName,$scrFileName);
  104 
  105 &delete_columns ($totalsFileName, -$noOfProbs-1, -2, 0);
  106 
  107 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9