[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 19 Apr 2003 09:02:57 -0000
albertel Sat Apr 19 05:02:57 2003 EDT
Modified files:
/loncom/homework grades.pm
Log:
- progress window
- unties hashes
- tries to count problems correct/incorrect
(probably should be a return value of sorts . . .)
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.84 loncom/homework/grades.pm:1.85
--- loncom/homework/grades.pm:1.84 Fri Apr 11 13:57:37 2003
+++ loncom/homework/grades.pm Sat Apr 19 05:02:57 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.84 2003/04/11 17:57:37 ng Exp $
+# $Id: grades.pm,v 1.85 2003/04/19 09:02:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2982,6 +2982,7 @@
my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'});
my $scanlines=Apache::File->new($Apache::lonnet::perlvar{'lonScansDir'}."/$ENV{'form.scantron_selectfile'}");
+ my @scanlines=<$scanlines>;
my $classlist=&Apache::loncoursedata::get_classlist();
my %idmap=&username_to_idmap($classlist);
my $navmap=Apache::lonnavmaps::navmap->new($ENV{'request.course.fn'}.'.db',$ENV{'request.course.fn'}.'_parms.db',1, 1);
@@ -2996,8 +2997,15 @@
$r->print($result);
my @delayqueue;
+ my $totalcorrect;
+ my $totalincorrect;
+
+ my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,
+ 'Scantron Status','Scantron Progress',scalar(@scanlines));
+ foreach my $line (@scanlines) {
+ my $studentcorrect;
+ my $studentincorrect;
- foreach my $line (<$scanlines>) {
chomp($line);
my $scan_record=&scantron_parse_scanline($line,\%scantron_config);
my ($uname,$udom);
@@ -3007,13 +3015,15 @@
}
$r->print('<pre>doing studnet'.$uname.'</pre>');
($uname,$udom)=split(/:/,$uname);
- &Apache::lonnet::delenv('form\.counter$'); #') stupid emacs
+ &Apache::lonnet::delenv('form.counter');
&Apache::lonnet::appenv(%$scan_record);
+# &Apache::lonhomework::showhash(%ENV);
$Apache::lonxml::debug=1;
- &Apache::lonhomework::showhash(%ENV);
- $Apache::lonxml::debug=0;
+ &Apache::lonxml::debug("line is $line");
+ my $i=0;
foreach my $resource (@resources) {
+ $i++;
my $result=&Apache::lonnet::ssi($resource->src(),
('submitted' =>'scantron',
'grade_target' =>'grade',
@@ -3021,13 +3031,30 @@
'grade_domain' =>$udom,
'grade_courseid'=>$ENV{'request.course.id'},
'grade_symb' =>$resource->symb()));
+ my %score=&Apache::lonnet::restore($resource->symb(),
+ $ENV{'request.course.id'},
+ $udom,$uname);
+ foreach my $part ($resource->{PARTS}) {
+ if ($score{'resource.'.$part.'.solved'} =~ /^correct/) {
+ $studentcorrect++;
+ $totalcorrect++;
+ } else {
+ $studentincorrect++;
+ $totalincorrect++;
+ }
+ }
$r->print('<pre>'.
$resource->symb().'-'.
$resource->src().'-'.'</pre>result is'.$result);
- last;
+ &Apache::lonhomework::showhash(%score);
+ # if ($i eq 3) {last;}
}
- &Apache::lonnet::delenv('form\.counter$'); #') stupid emacs
+ &Apache::lonnet::delenv('form.counter');
&Apache::lonnet::delenv('scantron\.');
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+ 'last student Who got a '.$studentcorrect.' correct and '.
+ $studentincorrect.' incorrect. The class has gotten '.
+ $totalcorrect.' correct and '.$totalincorrect.' incorrect');
last;
#FIXME
#get iterator for $sequence
@@ -3036,6 +3063,7 @@
# generate data to pass back that includes grade recevied
#}
}
+ $Apache::lonxml::debug=0;
foreach my $delay (@delayqueue) {
#FIXME
#print out each delayed student with interface to select how
@@ -3048,7 +3076,8 @@
#FIXME
# if delay queue exists 2 submits one to process delayed students one
# to ignore delayed students, possibly saving the delay queue for later
-
+
+ $navmap->untieHashes();
}
#-------- end of section for handling grading scantron forms -------
#