[LON-CAPA-cvs] cvs: modules /gerd extract.pl
www
lon-capa-cvs@mail.lon-capa.org
Thu, 24 Jul 2003 21:26:20 -0000
www Thu Jul 24 17:26:20 2003 EDT
Modified files:
/modules/gerd extract.pl
Log:
Newer version which sets SOLVED
Index: modules/gerd/extract.pl
diff -u modules/gerd/extract.pl:1.1 modules/gerd/extract.pl:1.2
--- modules/gerd/extract.pl:1.1 Mon Jul 15 08:34:25 2002
+++ modules/gerd/extract.pl Thu Jul 24 17:26:20 2003
@@ -4,7 +4,7 @@
#
# Extract datafiles, make anonymous
#
-# $Id: extract.pl,v 1.1 2002/07/15 12:34:25 www Exp $
+# $Id: extract.pl,v 1.2 2003/07/24 21:26:20 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -72,9 +72,15 @@
$res=$urlkey{$1};
}
$key=$mykey{$uname};
+ my $judge='';
+ if ($values=~/submitted\=yes/) {
+ $judge='SUBMIT';
+ } elsif ($values=~/awarded\=1/) {
+ $judge='SOLVED';
+ }
if (($key) && ($res!~/^adm\//)) {
print OUT ($time<1000000000?'0':'').$time.':'.$key.':'.$res.':'.
- $action.':'.$values."\n";
+ $action.':'.$judge."\n";
}
}
}
@@ -139,11 +145,31 @@
return $str;
}
+# ---------------------------------------------------------------- Write grades
+
+sub writegrds {
+ my $class=shift;
+ open(IN,'../rawdata/'.$class.'.grds') or die ('Input Grds');
+ open(OUT,'>../data/'.$class.'.grds') or die('Output Grds');
+ while ($line=<IN>) {
+ chomp($line);
+ if ($line=~/^(\w+).*\=\s+([\d\.]+)$/) {
+ if ($mykey{$1}) {
+ print OUT $mykey{$1}.':'.$2."\n";
+ }
+ }
+ }
+ close(OUT);
+ close(IN);
+}
+
+
# ================================================================ Main Program
$class=shift;
&readkey($class);
$othernum=0;
+&writegrds($class);
open(RESOUT,'>../data/'.$class.'.res');
&readseq($class);
&courselog($class);