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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : sam 11 #!/usr/local/bin/webwork-perl
2 : sam 2
3 :     ## $Id$
4 :    
5 : gage 8 use lib '.'; use webworkInit; # WeBWorKInitLine
6 : sam 2 use Global;
7 :    
8 :    
9 :     # This file is sortDataSet.pl
10 :    
11 :     ## takes three command line arguments. The first is the course name.
12 :     ## the second is a filename without the extension,
13 :     ## e.g. s5ful or s5scr. The third optional parameter determined the
14 :     ## sorting order. The default will be to sort alpabetically by section,
15 :     ## then by student name. If the third parameter is 'A', 'AbySec, 'AbyRec', 'S', or
16 :     ## 'SbySec','SbyRec', the sort order will be by student name, by section then by
17 :     ## student name, by recitation then by student name, by studentID, by section
18 :     ##then by studemtID, by recitation then by studemtID,
19 :     ## e.g. sortDataSet.pl s5ful or sortDataSet.pl s5ful S
20 :    
21 :    
22 :     if (@ARGV != 2 && @ARGV != 3)
23 :     {print "\nSyntax is\n\n sortDataSet.pl courseID newdataSetFile \n";
24 :     print " giving the default sortType of Alphabetical by Section ('AbySec')\n";
25 :     print "OR \n";
26 :     print " sortDataSet.pl courseID dataSetFile sortType \n\n";
27 :     print "where sortType is 'A' or 'AbySec' or 'AbyRec' or 'S' or 'SbySec' or 'SbyRec' \n\n";
28 :     print "File names are entered with or without the extension, e.g. enter s7scr or s7scr.csv \n";
29 :     print " (e.g. sortDataSet.pl MTH140A 140atotal ) \n";
30 :     print "OR \n";
31 :     print " (e.g. sortDataSet.pl MTH140A 140atotal SbySec ) \n\n";
32 :    
33 :     exit(0);
34 :     }
35 :    
36 :     #require "webwork.ph";
37 :     #require "${scriptDirectory}$DBglue_pl";
38 :     #require "${scriptDirectory}$SCRtools_pl";
39 :     #require "${scriptDirectory}FILE.pl";
40 :    
41 :     local($courseID,$fileName1,$sortOrderTag)=@ARGV;
42 :    
43 :     $scriptDirectory = $Global::scriptDirectory;
44 :     &Global::getCourseEnvironment($courseID);
45 :    
46 :     #require "${scriptDirectory}$Global::DBglue_pl";
47 :     require "${scriptDirectory}$Global::FILE_pl";
48 :     require "${scriptDirectory}$Global::SCRtools_pl";
49 :    
50 :     $fileName1 =~ s/\.$Global::dat$//; ## remove dat extension if present
51 :    
52 :     unless (($sortOrderTag eq 'A') or ($sortOrderTag eq 'S') or ($sortOrderTag eq 'SbySec') or ($sortOrderTag eq 'AbyRec') or ($sortOrderTag eq 'SbyRec') ) {$sortOrderTag="AbySec";}
53 :     local(*assocArray);
54 :    
55 :     %assocArray = &dat2aa("$fileName1");
56 :     &aa2dat(*assocArray,"$fileName1", $sortOrderTag); ##sort

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9