--- loncom/homework/grades.pm 2003/07/16 19:28:08 1.117
+++ loncom/homework/grades.pm 2003/09/25 02:46:19 1.130.2.1.2.2
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.117 2003/07/16 19:28:08 bowersj2 Exp $
+# $Id: grades.pm,v 1.130.2.1.2.2 2003/09/25 02:46:19 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,6 +33,7 @@
# June-August H.K. Ng
# Year 2003
# February, March H.K. Ng
+# July, H. K. Ng
#
package Apache::grades;
@@ -95,10 +96,23 @@ sub get_fullname {
return $fullname;
}
+#--- Format fullname, username:domain if different for display
+#--- Use anywhere where the student names are listed
+sub nameUserString {
+ my ($type,$fullname,$uname,$udom) = @_;
+ if ($type eq 'header') {
+ return ' Fullname (Username) ';
+ } else {
+ return ' '.$fullname.' ('.$uname.
+ ($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').') ';
+ }
+}
+
#--- Get the partlist and the response type for a given problem. ---
#--- Indicate if a response type is coded handgraded or not. ---
sub response_type {
- my ($url) = shift;
+ my ($url,$symb) = shift;
+ $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))) if ($symb eq '');
my $allkeys = &Apache::lonnet::metadata($url,'keys');
my %seen = ();
my (@partlist,%handgrade);
@@ -106,7 +120,9 @@ sub response_type {
if (/^\w+response_\w+.*/) {
my ($responsetype,$part) = split(/_/,$_,2);
my ($partid,$respid) = split(/_/,$part);
- $handgrade{$part} = $responsetype.':'.($allkeys =~ /parameter_$part\_handgrade/ ? 'yes' : 'no');
+ $responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!!
+ my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb);
+ $handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no');
next if ($seen{$partid} > 0);
$seen{$partid}++;
push @partlist,$partid;
@@ -115,10 +131,105 @@ sub response_type {
return \@partlist,\%handgrade;
}
+#--- Show resource title
+#--- and parts and response type
+sub showResourceInfo {
+ my ($url,$probTitle) = @_;
+ my $result ='
'.
- ' '."\n";
- if ($ENV{'form.handgrade'} eq 'yes') {
- $endform.=' '."\n";
- my $ntstu =''.
- '1 2 '.
- '3 5 '.
- '7 10 '."\n";
- my $nsel = ($ENV{'form.NTSTU'} ne '' ? $ENV{'form.NTSTU'} : '1');
- $ntstu =~ s/$nsel $nsel;
- $endform.=$ntstu.'student(s) ';
- } else {
- $endform.=' '."\n";
- }
- $endform.=' '."\n".
- ' ';
- $endform.='(Next and Previous do not save the scores.)'."\n"
- if ($ENV{'form.handgrade'} eq 'yes');
+ my $endform='';
$endform.=&show_grading_menu_form($symb,$url);
$request->print($endform);
@@ -1442,15 +1591,15 @@ KEYWORDS
#--- Retrieve the last submission for all the parts
sub get_last_submission {
- my (%returnhash)=@_;
+ my ($returnhash)=@_;
my (@string,$timestamp);
- if ($returnhash{'version'}) {
+ if ($$returnhash{'version'}) {
my %lasthash=();
my ($version);
- for ($version=1;$version<=$returnhash{'version'};$version++) {
- foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) {
- $lasthash{$_}=$returnhash{$version.':'.$_};
- $timestamp = scalar(localtime($returnhash{$version.':timestamp'}));
+ for ($version=1;$version<=$$returnhash{'version'};$version++) {
+ foreach (sort(split(/\:/,$$returnhash{$version.':keys'}))) {
+ $lasthash{$_}=$$returnhash{$version.':'.$_};
+ $timestamp = scalar(localtime($$returnhash{$version.':timestamp'}));
}
}
foreach ((keys %lasthash)) {
@@ -1462,7 +1611,7 @@ sub get_last_submission {
}
}
}
- @string = $string[0] eq '' ? 'Nothing submitted - no attempts.' : @string;
+ @string = $string[0] eq '' ? 'Nothing submitted - no attempts. ' : @string;
return \@string,\$timestamp;
}
@@ -1474,13 +1623,8 @@ sub keywords_highlight {
(my $styleoff = $styleon) =~ s/\\<\//;
my @keylist = split(/[,\s+]/,$ENV{'form.keywords'});
foreach (@keylist) {
- $string =~ s/\b\Q$_\E(\b|\.)/\$styleon$_$styleoff\<\/font\>/gi;
+ $string =~ s/\b\Q$_\E(\b|\.)/$styleon$_$styleoff<\/font>/gi;
}
- # This is not really the right place to do this, but I cannot find a
- # better one at this time. So here we go - the m in the s:::mg causes
- # ^ to match the beginning of a new line. So we replace(???) the beginning
- # of the line with to make things formatted a little better.
- $string =~ s:^: :mg;
return $string;
}
@@ -1492,7 +1636,6 @@ sub processHandGrade {
my $button = $ENV{'form.gradeOpt'};
my $ngrade = $ENV{'form.NCT'};
my $ntstu = $ENV{'form.NTSTU'};
-
if ($button eq 'Save & Next') {
my $ctr = 0;
while ($ctr < $ngrade) {
@@ -1526,7 +1669,8 @@ sub processHandGrade {
if ($ENV{'form.collaborator'.$ctr}) {
my (@collaborators) = split(/:/,$ENV{'form.collaborator'.$ctr});
foreach (@collaborators) {
- my ($errorflag,$pts,$wgt) = &saveHandGrade($request,$url,$symb,$_,$udom,$ctr,$ENV{'form.unamedom'.$ctr});
+ my ($errorflag,$pts,$wgt) =
+ &saveHandGrade($request,$url,$symb,$_,$udom,$ctr,$ENV{'form.unamedom'.$ctr});
if ($errorflag eq 'not_allowed') {
$request->print("Not allowed to modify grades for $_:$udom ");
next;
@@ -1543,48 +1687,49 @@ sub processHandGrade {
}
}
- # Keywords sorted in alphabatical order
- my $loginuser = $ENV{'user.name'}.':'.$ENV{'user.domain'};
- my %keyhash = ();
- $ENV{'form.keywords'} =~ s/,\s{0,}|\s+/ /g;
- $ENV{'form.keywords'} =~ s/^\s+|\s+$//;
- my (@keywords) = sort(split(/\s+/,$ENV{'form.keywords'}));
- $ENV{'form.keywords'} = join(' ',@keywords);
- $keyhash{$symb.'_keywords'} = $ENV{'form.keywords'};
- $keyhash{$symb.'_subject'} = $ENV{'form.msgsub'};
- $keyhash{$loginuser.'_kwclr'} = $ENV{'form.kwclr'};
- $keyhash{$loginuser.'_kwsize'} = $ENV{'form.kwsize'};
- $keyhash{$loginuser.'_kwstyle'} = $ENV{'form.kwstyle'};
-
- # message center - Order of message gets changed. Blank line is eliminated.
- # New messages are saved in ENV for the next student.
- # All messages are saved in nohist_handgrade.db
- my ($ctr,$idx) = (1,1);
- while ($ctr <= $ENV{'form.savemsgN'}) {
- if ($ENV{'form.savemsg'.$ctr} ne '') {
- $keyhash{$symb.'_savemsg'.$idx} = $ENV{'form.savemsg'.$ctr};
- $idx++;
+ if ($ENV{'form.handgrade'} eq 'yes') {
+ # Keywords sorted in alphabatical order
+ my $loginuser = $ENV{'user.name'}.':'.$ENV{'user.domain'};
+ my %keyhash = ();
+ $ENV{'form.keywords'} =~ s/,\s{0,}|\s+/ /g;
+ $ENV{'form.keywords'} =~ s/^\s+|\s+$//;
+ my (@keywords) = sort(split(/\s+/,$ENV{'form.keywords'}));
+ $ENV{'form.keywords'} = join(' ',@keywords);
+ $keyhash{$symb.'_keywords'} = $ENV{'form.keywords'};
+ $keyhash{$symb.'_subject'} = $ENV{'form.msgsub'};
+ $keyhash{$loginuser.'_kwclr'} = $ENV{'form.kwclr'};
+ $keyhash{$loginuser.'_kwsize'} = $ENV{'form.kwsize'};
+ $keyhash{$loginuser.'_kwstyle'} = $ENV{'form.kwstyle'};
+
+ # message center - Order of message gets changed. Blank line is eliminated.
+ # New messages are saved in ENV for the next student.
+ # All messages are saved in nohist_handgrade.db
+ my ($ctr,$idx) = (1,1);
+ while ($ctr <= $ENV{'form.savemsgN'}) {
+ if ($ENV{'form.savemsg'.$ctr} ne '') {
+ $keyhash{$symb.'_savemsg'.$idx} = $ENV{'form.savemsg'.$ctr};
+ $idx++;
+ }
+ $ctr++;
}
- $ctr++;
- }
- $ctr = 0;
- while ($ctr < $ngrade) {
- if ($ENV{'form.newmsg'.$ctr} ne '') {
- $keyhash{$symb.'_savemsg'.$idx} = $ENV{'form.newmsg'.$ctr};
- $ENV{'form.savemsg'.$idx} = $ENV{'form.newmsg'.$ctr};
- $idx++;
+ $ctr = 0;
+ while ($ctr < $ngrade) {
+ if ($ENV{'form.newmsg'.$ctr} ne '') {
+ $keyhash{$symb.'_savemsg'.$idx} = $ENV{'form.newmsg'.$ctr};
+ $ENV{'form.savemsg'.$idx} = $ENV{'form.newmsg'.$ctr};
+ $idx++;
+ }
+ $ctr++;
}
- $ctr++;
+ $ENV{'form.savemsgN'} = --$idx;
+ $keyhash{$symb.'_savemsgN'} = $ENV{'form.savemsgN'};
+ my $putresult = &Apache::lonnet::put
+ ('nohist_handgrade',\%keyhash,
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
}
- $ENV{'form.savemsgN'} = --$idx;
- $keyhash{$symb.'_savemsgN'} = $ENV{'form.savemsgN'};
- my $putresult = &Apache::lonnet::put
- ('nohist_handgrade',\%keyhash,
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
-
# Called by Save & Refresh from Highlight Attribute Window
- my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0');
+ my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1');
if ($ENV{'form.refresh'} eq 'on') {
my ($ctr,$total) = (0,0);
while ($ctr < $ngrade) {
@@ -1603,10 +1748,20 @@ sub processHandGrade {
return '';
}
+# Go directly to grade student - from submission or link from chart page
+ if ($button eq 'Grade Student') {
+ (undef,undef,$ENV{'form.handgrade'},undef,undef) = &showResourceInfo($url);
+ my $processUser = $ENV{'form.unamedom'.$ENV{'form.studentNo'}};
+ ($ENV{'form.student'},$ENV{'form.userdom'}) = split(/:/,$processUser);
+ $ENV{'form.fullname'} = $$fullname{$processUser};
+ &submission($request,0,0);
+ return '';
+ }
+
# Get the next/previous one or group of students
my $firststu = $ENV{'form.unamedom0'};
my $laststu = $ENV{'form.unamedom'.($ngrade-1)};
- $ctr = 2;
+ my $ctr = 2;
while ($laststu eq '') {
$laststu = $ENV{'form.unamedom'.($ngrade-$ctr)};
$ctr++;
@@ -1626,21 +1781,19 @@ sub processHandGrade {
}
}
$ctr = 0;
- my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
@parsedlist = reverse @parsedlist if ($button eq 'Previous');
foreach my $student (@parsedlist) {
my ($uname,$udom) = split(/:/,$student);
if ($ENV{'form.submitonly'} eq 'yes') {
- my (%status) = &student_gradeStatus($ENV{'form.url'},$symb,$udom,$uname,$partlist) ;
+ my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
my $statusflg = '';
- foreach (keys(%status)) {
- $statusflg = 1 if ($status{$_} ne 'nothing');
- my ($foo,$partid,$foo1) = split(/\./);
- $statusflg = '' if ($status{'resource.'.$partid.'.submitted_by'} ne '');
+ foreach (split(/:/,$ENV{'form.gradePartRespid'})){
+ $statusflg = 1 if (exists ($record{'resource.'.$_.'.submission'}));
}
next if ($statusflg eq '');
}
push @nextlist,$student if ($ctr < $ntstu);
+ last if ($ctr == $ntstu);
$ctr++;
}
@@ -1675,14 +1828,23 @@ sub saveHandGrade {
my %newrecord = ();
my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
- if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') {
+ my $dropMenu = $ENV{'form.GD_SEL'.$newflg.'_'.$_};
+ if ($dropMenu eq 'excused') {
if ($record{'resource.'.$_.'.solved'} ne 'excused') {
$newrecord{'resource.'.$_.'.solved'} = 'excused';
if (exists($record{'resource.'.$_.'.awarded'})) {
$newrecord{'resource.'.$_.'.awarded'} = '';
}
+ $newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
}
- } else {
+ } elsif ($dropMenu eq 'reset status'
+ && exists($record{'resource.'.$_.'.solved'})) { #don't bother if no old records -> no attempts
+ $newrecord{'resource.'.$_.'.tries'} = 0;
+ $newrecord{'resource.'.$_.'.solved'} = '';
+ $newrecord{'resource.'.$_.'.award'} = '';
+ $newrecord{'resource.'.$_.'.awarded'} = 0;
+ $newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ } elsif ($dropMenu eq '') {
$pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
$ENV{'form.GD_BOX'.$newflg.'_'.$_} :
$ENV{'form.RADVAL'.$newflg.'_'.$_});
@@ -1690,6 +1852,7 @@ sub saveHandGrade {
$wgt = $ENV{'form.WGT'.$newflg.'_'.$_} eq '' ? 1 :
$ENV{'form.WGT'.$newflg.'_'.$_};
my $partial= $pts/$wgt;
+ next if ($partial eq $record{'resource.'.$_.'.awarded'}); #do not update score for part if not changed.
$newrecord{'resource.'.$_.'.awarded'} = $partial
if ($record{'resource.'.$_.'.awarded'} ne $partial);
my $reckey = 'resource.'.$_.'.solved';
@@ -1702,7 +1865,7 @@ sub saveHandGrade {
}
$newrecord{'resource.'.$_.'.submitted_by'} = $submitter
if ($submitter && ($record{'resource.'.$_.'.submitted_by'} ne $submitter));
- $newrecord{'resource.'.$_.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ $newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
}
}
@@ -1724,10 +1887,10 @@ sub viewgrades_js {
$request->print(<
function writePoint(partid,weight,point) {
- var radioButton = eval("document.classgrade.RADVAL_"+partid);
- var textbox = eval("document.classgrade.TEXTVAL_"+partid);
+ var radioButton = document.classgrade["RADVAL_"+partid];
+ var textbox = document.classgrade["TEXTVAL_"+partid];
if (point == "textval") {
- var point = eval("document.classgrade.TEXTVAL_"+partid+".value");
+ point = document.classgrade["TEXTVAL_"+partid].value;
if (isNaN(point) || parseFloat(point) < 0) {
alert("A number equal or greater than 0 is expected. Entered value = "+parseFloat(point));
var resetbox = false;
@@ -1758,15 +1921,13 @@ sub viewgrades_js {
}
} else {
- textbox.value = point;
+ textbox.value = parseFloat(point);
}
for (i=0;iManual Grading ';
- $result.='Problem: '.$ENV{'form.probTitle'}.' '."\n";
+ $result.='Current Resource: '.$ENV{'form.probTitle'}.' '."\n";
#view individual student submission form - called using Javascript viewOneStudent
$result.=&jscriptNform($url,$symb);
@@ -1907,21 +2065,23 @@ sub viewgrades {
' '."\n".
' '."\n".
' '."\n".
+ ' '."\n".
' '."\n";
- $result.='Assign Common Grade To ';
+ my $sectionClass;
if ($ENV{'form.section'} eq 'all') {
- $result.='Class ';
+ $sectionClass='Class ';
} elsif ($ENV{'form.section'} eq 'no') {
- $result.='Students in no Section ';
+ $sectionClass='Students in no Section ';
} else {
- $result.='Students in Section '.$ENV{'form.section'}.'';
+ $sectionClass='Students in Section '.$ENV{'form.section'}.'';
}
+ $result.='Assign Common Grade To '.$sectionClass;
$result.= ' '."\n".
'';
#radio buttons/text box for assigning points for a section or class.
#handles different parts of a problem
- my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
+ my ($partlist,$handgrade) = &response_type($url,$symb);
my %weight = ();
my $ctsparts = 0;
$result.='';
@@ -1957,33 +2117,25 @@ sub viewgrades {
'onChange="javascript:writeRadText(\''.$partid.'\','.
$weight{$partid}.')"> '.
' '.
- 'excused '."\n";
+ 'excused '.
+ 'reset status '."\n";
$ctsparts++;
}
$result.='
'.'
'.'
'."\n".
' ';
$result.=' ';
-# $result.=' '."\n";
#table listing all the students in a section/class
#header of table
- $result.= 'Assign Grade to Specific Students in ';
- if ($ENV{'form.section'} eq 'all') {
- $result.='the Class ';
- } elsif ($ENV{'form.section'} eq 'no') {
- $result.='no Section ';
- } else {
- $result.='Section '.$ENV{'form.section'}.'';
- }
+ $result.= 'Assign Grade to Specific Students in '.$sectionClass;
$result.= ' '."\n".
- ''.
- 'Fullname (Username) '."\n";
+ ' No. '.
+ ''.&nameUserString('header')." \n";
my (@parts) = sort(&getpartlist($url));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
- next if ($display =~ /Number of Attempts/);
+ $display =~ s|^Number of Attempts|Tries |; # makes the column narrower
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
if ($display =~ /^Partial Credit Factor/) {
my ($partid) = &split_part_type($part);
@@ -2004,13 +2156,13 @@ sub viewgrades {
my $uname = $_;
$uname=~s/:/_/;
$result.=' '."\n";
- $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},
- $_,$$fullname{$_},\@parts,\%weight);
$ctr++;
+ $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},
+ $_,$$fullname{$_},\@parts,\%weight,$ctr);
}
$result.='
';
$result.=' '."\n";
- $result.=' '."\n";
if (scalar(%$fullname) eq 0) {
my $colspan=3+scalar(@parts);
@@ -2023,11 +2175,11 @@ sub viewgrades {
#--- call by previous routine to display each student
sub viewstudentgrade {
- my ($url,$symb,$courseid,$student,$fullname,$parts,$weight) = @_;
+ my ($url,$symb,$courseid,$student,$fullname,$parts,$weight,$ctr) = @_;
my ($uname,$udom) = split(/:/,$student);
$student=~s/:/_/;
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
- my $result=' '.
+ my $result=' '.$ctr.' '.
''.$fullname.' '.
'('.$uname.($ENV{'user.domain'} eq $udom ? '' : ':'.$udom).') '."\n";
@@ -2047,21 +2199,20 @@ sub viewstudentgrade {
$status = 'nothing' if ($status eq '');
$result.=' '."\n";
- $result.=' '."\n";
- my $optsel = ' excused '."\n";
- $optsel = ' excused '."\n"
- if ($status eq 'excused');
- $result.=$optsel;
- $result.=" \n";
-# } else {
-# $result.=' '.
-# "\n";
-# $result.=' '."\n";
+ $result.= (($status eq 'excused') ? ' excused '
+ : ' excused ')."\n";
+ $result.='reset status ';
+ $result.=" \n";
+ } else {
+ $result.=' '.
+ "\n";
+ $result.=' '."\n";
}
}
$result.=' ';
@@ -2076,11 +2227,13 @@ sub editgrades {
my $symb=$ENV{'form.symb'};
my $url =$ENV{'form.url'};
my $title='Current Grade Status ';
- $title.='Problem: '.$ENV{'form.probTitle'}.' '."\n";
+ $title.='Current Resource: '.$ENV{'form.probTitle'}.' '."\n";
$title.='Section: '.$ENV{'form.section'}.' '."\n";
+
my $result= ''."\n";
$result.= ''.
- 'Username Domain Fullname '."\n";
+ ' No. '.
+ ''.&nameUserString('header')." \n";
my %scoreptr = (
'correct' =>'correct_by_override',
@@ -2114,8 +2267,9 @@ sub editgrades {
if ($type eq 'awarded' || $type eq 'solved') { next; }
my $display=&Apache::lonnet::metadata($url,$stores.'.display');
$display =~ s/\[Part: (\w)+\]//;
- $header .= ' Old '.$display.' '.
- ' New '.$display.' ';
+ $display =~ s/Number of Attempts/Tries/;
+ $header .= ' Old '.$display.' '.
+ ' New '.$display.' ';
$columns{$partid}+=2;
}
}
@@ -2129,6 +2283,7 @@ sub editgrades {
$result .= $header;
$result .= ' '."\n";
my $noupdate;
+ my ($updateCtr,$noupdateCtr) = (1,1);
for ($i=0; $i<$ENV{'form.total'}; $i++) {
my $line;
my $user = $ENV{'form.ctr'.$i};
@@ -2137,12 +2292,10 @@ sub editgrades {
my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- $line .= ''.$uname.' '.
- $udom.' '.
- $$fullname{$usercolon}.' ';
+ $line .= ''.&nameUserString(undef,$$fullname{$usercolon},$uname,$udom).' ';
my $usec=$classlist->{"$uname:$udom"}[5];
if (!&canmodify($usec)) {
- my $numcols=scalar(@partid)*(scalar(@parts)-1)*2;
+ my $numcols=scalar(@partid)*4+2;
$noupdate.=$line."Not allowed to modify student ";
next;
}
@@ -2163,8 +2316,19 @@ sub editgrades {
} elsif ($partial == 0) {
$score = 'incorrect_by_override';
}
- $score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_solved'} eq 'excused') &&
- ($score ne 'excused'));
+ my $dropMenu = $ENV{'form.GD_'.$user.'_'.$_.'_solved'};
+ $score = 'excused' if (($dropMenu eq 'excused') && ($score ne 'excused'));
+
+ if ($dropMenu eq 'reset status' &&
+ $old_score ne '') { # ignore if no previous attempts => nothing to reset
+ $newrecord{'resource.'.$_.'.tries'} = 0;
+ $newrecord{'resource.'.$_.'.solved'} = '';
+ $newrecord{'resource.'.$_.'.award'} = '';
+ $newrecord{'resource.'.$_.'.awarded'} = 0;
+ $newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ $updateflag = 1;
+ }
+
$line .= ''.$old_aw.' '.
''.$awarded.
($score eq 'excused' ? $score : '').' ';
@@ -2185,7 +2349,7 @@ sub editgrades {
my $awarded = $ENV{'form.GD_'.$user.'_'.$part.'_'.$type};
if ($awarded ne '' && $awarded ne $old_aw) {
$newrecord{'resource.'.$part.'.'.$type}= $awarded;
- $newrecord{'resource.'.$part.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ $newrecord{'resource.'.$part.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
$updateflag=1;
}
$line .= ''.$old_aw.' '.
@@ -2197,18 +2361,21 @@ sub editgrades {
$count++;
&Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},
$udom,$uname);
- $result.=$line;
+ $result.=' '.$updateCtr.' '.$line;
+ $updateCtr++;
} else {
- $noupdate.=$line;
+ $noupdate.=' '.$noupdateCtr.' '.$line;
+ $noupdateCtr++;
}
}
if ($noupdate) {
- my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
- $result .= 'No Changes Occured For the Students Below '.$noupdate;
+# my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
+ my $numcols=scalar(@partid)*4+2;
+ $result .= 'No Changes Occurred For the Students Below '.$noupdate;
}
$result .= '
'."\n".
&show_grading_menu_form ($symb,$url);
- my $msg = 'Number of records updated = '.$rec_update.
+ my $msg = 'Number of records updated = '.$rec_update.
' for '.$count.' student'.($count <= 1 ? '' : 's').'. '.
'Total number of students = '.$ENV{'form.total'}.' ';
return $title.$msg.$result;
@@ -2314,19 +2481,8 @@ sub csvuploadmap_header {
$javascript=&csvupload_javascript_forward_associate();
}
- my $result='';
- $result.='Problem: '.$ENV{'form.probTitle'}.' ';
- my ($partlist,$handgrade) = &response_type($url);
- my ($resptype,$hdgrade)=('','no');
- for (sort keys(%$handgrade)) {
- my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
- $resptype = $responsetype;
- $hdgrade = $handgrade if ($handgrade eq 'yes');
- $result.='Part '.(split(/_/))[0].' '.
- 'Type: '.$responsetype.' '.
- 'Handgrade: '.$handgrade.' ';
- }
- $result.='
';
+ my ($result) = &showResourceInfo($url,$ENV{'form.probTitle'});
+
$request->print(<
Uploading Class Grades
@@ -2354,7 +2510,7 @@ to this page if the data selected is ins
$javascript
ENDPICK
-return '';
+ return '';
}
@@ -2400,9 +2556,11 @@ sub upcsvScores_form {
CSVFORMJS
$ENV{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
+ my ($table) = &showResourceInfo($url,$ENV{'form.probTitle'});
+ $result.=$table;
$result.=''."\n";
$result.=''."\n";
- $result.=' Specify a file containing the class scores for problem - '.$ENV{'form.probTitle'}.
+ $result.=' Specify a file containing the class scores for current resource'.
'. '."\n";
$result.=''."\n";
my $upfile_select=&Apache::loncommon::upfile_select_html();
@@ -2421,7 +2579,6 @@ ENDUPFORM
$result.='
'."\n";
$result.='
'."\n";
$result.=&show_grading_menu_form($symb,$url);
-
return $result;
}
@@ -2535,7 +2692,7 @@ sub csvuploadassign {
#
#-------------------------------------------------------------------
#
-#-------------- Next few routines handles grading by page/sequence
+#-------------- Next few routines handle grading by page/sequence
#
#--- Select a page/sequence and a student to grade
sub pickStudentPage {
@@ -2549,41 +2706,15 @@ function checkPickOne(formname) {
alert("Please select the student you wish to grade.");
return;
}
- var ptr = pullDownSelection(formname.selectpage);
- formname.page.value = eval("formname.page"+ptr+".value");
- formname.title.value = eval("formname.title"+ptr+".value");
+ ptr = pullDownSelection(formname.selectpage);
+ formname.page.value = formname["page"+ptr].value;
+ formname.title.value = formname["title"+ptr].value;
formname.submit();
}
-function radioSelection(radioButton) {
- var selection=null;
- if (radioButton.length > 1) {
- for (var i=0; i 1) {
- for (var i=0; i
LISTJAVASCRIPT
-
+ &commonJSfunctions($request);
my ($symb,$url) = &get_symb_and_url($request);
my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"};
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"};
@@ -2620,45 +2751,44 @@ LISTJAVASCRIPT
$result.=' Submission Details: '.
' none'."\n".
- ' dates and submissions'."\n".
+ ' by dates and submissions'."\n".
' all details'."\n";
$result.=' '."\n".
- ' '."\n".
+ ' '."\n".
' '."\n".
' '."\n".
' '."\n".
' '." \n";
$result.=' '."\n";
+ 'onClick="javascript:checkPickOne(this.form);"value="Next->" /> '."\n";
$request->print($result);
- my $studentTable.=' Select a student you wish to grade '.
+ my $studentTable.=' Select a student you wish to grade and then click on the Next button. '.
''."\n";
- $studentTable.=' '."\n";
+ $studentTable.=' " />'."\n";
$studentTable.=&show_grading_menu_form($symb,$url);
$request->print($studentTable);
@@ -2670,7 +2800,7 @@ sub getSymbMap {
my ($request) = @_;
my $navmap = Apache::lonnavmaps::navmap-> new($ENV{'request.course.fn'}.'.db',
$ENV{'request.course.fn'}.'_parms.db');
- $navmap->init();
+# $navmap->init();
my %symbx = ();
my @titles = ();
@@ -2710,9 +2840,8 @@ sub displayPage {
return;
}
my $result=' '.$ENV{'form.title'}.' ';
- $result.=' Student: '.$$fullname{$ENV{'form.student'}}.
- ' ('.$uname.($udom eq $cdom ? '':':'.$udom).') '."\n";
-
+ $result.=' Student: '.&nameUserString(undef,$$fullname{$ENV{'form.student'}},$uname,$udom).
+ ' '."\n";
&sub_page_js($request);
$request->print($result);
@@ -2726,22 +2855,24 @@ sub displayPage {
my $studentTable=''."\n";
$studentTable.=&show_grading_menu_form($symb,$url);
@@ -2845,24 +2946,45 @@ sub displayPage {
return '';
}
-sub cleanRecord {
- my ($answer,$response) = @_;
- if ($response eq 'option') {
- my (@IDs,@ans);
- foreach (split(/\&/,&Apache::lonnet::unescape($answer))) {
- my ($optionID,$ans) = split(/=/);
- push @IDs,$optionID.'';
- push @ans,$ans;
- }
- my $grayFont = '';
- return ''.
- 'Answer '.
- (join ' ',@ans).' '.
- ''.$grayFont.'Option ID '.$grayFont.
- (join ' '.$grayFont,@IDs).' '.
- '
';
+sub displaySubByDates {
+ my ($symbx,$record,$parts,$responseType,$checkIcon) = @_;
+ my $studentTable=''.
+ ''.
+ 'Date/Time '.
+ 'Submission '.
+ 'Status ';
+ my ($version);
+ my %mark;
+ $mark{'correct_by_student'} = $checkIcon;
+ return ' Nothing submitted - no attempts '
+ if (!exists($$record{'1:timestamp'}));
+ for ($version=1;$version<=$$record{'version'};$version++) {
+ my $timestamp = scalar(localtime($$record{$version.':timestamp'}));
+ $studentTable.=''.$timestamp.' ';
+ my @versionKeys = split(/\:/,$$record{$version.':keys'});
+ my @displaySub = ();
+ foreach my $partid (@{$parts}) {
+ my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys;
+# next if ($$record{"$version:resource.$partid.solved"} eq '');
+ $displaySub[0].=(exists $$record{$version.':'.$matchKey[0]}) ?
+ 'Part '.$partid.' '.
+ ($$record{"$version:resource.$partid.tries"} eq '' ? 'Trial not counted' :
+ 'Trial '.$$record{"$version:resource.$partid.tries"}).' '.
+ &cleanRecord($$record{$version.':'.$matchKey[0]},$$responseType{$partid},$$symbx).' ' : '';
+ $displaySub[1].=(exists $$record{"$version:resource.$partid.award"}) ?
+ 'Part '.$partid.' '.
+ lc($$record{"$version:resource.$partid.award"}).' '.
+ $mark{$$record{"$version:resource.$partid.solved"}}.' ' : '';
+ $displaySub[2].=(exists $$record{"$version:resource.$partid.regrader"}) ?
+ $$record{"$version:resource.$partid.regrader"}.' (Part: '.$partid.')' : '';
+ }
+ $displaySub[2].=(exists $$record{"$version:resource.regrader"}) ?
+ $$record{"$version:resource.regrader"} : ''; # needed because old essay regrader has not parts info
+ $studentTable.=''.$displaySub[0].' '.$displaySub[1].
+ ($displaySub[2] eq '' ? '' : 'Manually graded by '.$displaySub[2]).' ';
}
- return $answer;
+ $studentTable.='
';
+ return $studentTable;
}
sub updateGradeByPage {
@@ -2881,8 +3003,8 @@ sub updateGradeByPage {
return;
}
my $result=' '.$ENV{'form.title'}.' ';
- $result.=' Student: '.$$fullname{$ENV{'form.student'}}.
- ' ('.$uname.($udom eq $cdom ? '':':'.$udom).') '."\n";
+ $result.=' Student: '.&nameUserString(undef,$ENV{'form.fullname'},$uname,$udom).
+ ' '."\n";
$request->print($result);
@@ -2896,7 +3018,7 @@ sub updateGradeByPage {
my $studentTable=''.
''.
- ' No '.
+ ' Prob. '.
' Title '.
' Previous Score '.
' New Score ';
@@ -2928,31 +3050,39 @@ sub updateGradeByPage {
my $score;
if ($partial > 0) {
$score = 'correct_by_override';
- } elsif ($partial == 0) {
+ } elsif ($newpts ne '') { #empty is taken as 0
$score = 'incorrect_by_override';
}
- if ($ENV{'form.GD_SEL'.$question.'_'.$partid} eq 'excused') {
+ my $dropMenu = $ENV{'form.GD_SEL'.$question.'_'.$partid};
+ if ($dropMenu eq 'excused') {
$partial = '';
$score = 'excused';
+ } elsif ($dropMenu eq 'reset status'
+ && $ENV{'form.solved'.$question.'_'.$partid} ne '') { #update only if previous record exists
+ $newrecord{'resource.'.$partid.'.tries'} = 0;
+ $newrecord{'resource.'.$partid.'.solved'} = '';
+ $newrecord{'resource.'.$partid.'.award'} = '';
+ $newrecord{'resource.'.$partid.'.awarded'} = 0;
+ $newrecord{'resource.'.$partid.'.regrader'} = "$ENV{'user.name'}:$ENV{'user.domain'}";
+ $changeflag++;
+ $newpts = '';
}
+
my $oldstatus = $ENV{'form.solved'.$question.'_'.$partid};
$displayPts[0].=' Part '.$partid.' = '.
(($oldstatus eq 'excused') ? 'excused' : $oldpts).
' ';
$displayPts[1].=' Part '.$partid.' = '.
- ($oldstatus eq 'correct_by_student' ? $oldpts :
- (($score eq 'excused') ? 'excused' : $newpts)).
+ (($score eq 'excused') ? 'excused' : $newpts).
' ';
$question++;
- if (($oldstatus eq 'correct_by_student') ||
- ($newpts eq $oldpts && $score eq $oldstatus))
- {
- next;
- }
+ next if ($dropMenu eq 'reset status' || ($newpts == $oldpts && $score ne 'excused'));
+
$newrecord{'resource.'.$partid.'.awarded'} = $partial if $partial ne '';
- $newrecord{'resource.'.$partid.'.solved'} = $score;
- $newrecord{'resource.'.$partid.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ $newrecord{'resource.'.$partid.'.solved'} = $score if $score ne '';
+ $newrecord{'resource.'.$partid.'.regrader'} = "$ENV{'user.name'}:$ENV{'user.domain'}"
+ if (scalar(keys(%newrecord)) > 0);
$changeflag++;
}
@@ -2960,6 +3090,7 @@ sub updateGradeByPage {
&Apache::lonnet::cstore(\%newrecord,$symbx,$ENV{'request.course.id'},
$udom,$uname);
}
+
$studentTable.=''.$displayPts[0].' '.
''.$displayPts[1].' '.
'';
@@ -3015,6 +3146,8 @@ sub getSequenceDropDown {
}
sub scantron_uploads {
+ #FIXME need to support scantron files put in another location,
+ # maybe the course directory? a scantron dir in the course directory?
if (!-e $Apache::lonnet::perlvar{'lonScansDir'}) { return ''};
my $result= '';
opendir(DIR,$Apache::lonnet::perlvar{'lonScansDir'});
@@ -3051,9 +3184,11 @@ sub scantron_selectphase {
my $file_selector=&scantron_uploads();
my $format_selector=&scantron_scantab();
my $result;
+ #FIXME allow instructor to be able to download the scantron file
+ # and to upload it,
$result.= <
-
+
$default_form_data
@@ -3083,7 +3218,7 @@ sub scantron_selectphase {
-
+
$grading_menu_button
SCANTRONFORM
@@ -3095,6 +3230,7 @@ sub get_scantron_config {
my ($which) = @_;
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab');
my %config;
+ #FIXME probably should move to XML it has already gotten a bit much now
foreach my $line (<$fh>) {
my ($name,$descrip)=split(/:/,$line);
if ($name ne $which ) { next; }
@@ -3111,6 +3247,12 @@ sub get_scantron_config {
$config{'Qlength'}=$config[8];
$config{'Qoff'}=$config[9];
$config{'Qon'}=$config[10];
+ $config{'PaperID'}=$config[11];
+ $config{'PaperIDlength'}=$config[12];
+ $config{'FirstName'}=$config[13];
+ $config{'FirstNamelength'}=$config[14];
+ $config{'LastName'}=$config[15];
+ $config{'LastNamelength'}=$config[16];
last;
}
return %config;
@@ -3141,6 +3283,15 @@ sub scantron_parse_scanline {
}
$record{'scantron.ID'}=substr($data,$$scantron_config{'IDstart'}-1,
$$scantron_config{'IDlength'});
+ $record{'scantron.paperID'}=
+ substr($data,$$scantron_config{'PaperID'}-1,
+ $$scantron_config{'PaperIDlength'});
+ $record{'scantron.FirstName'}=
+ substr($data,$$scantron_config{'FirstName'}-1,
+ $$scantron_config{'FirstNamelength'});
+ $record{'scantron.LastName'}=
+ substr($data,$$scantron_config{'LastName'}-1,
+ $$scantron_config{'LastNamelength'});
my @alphabet=('A'..'Z');
my $questnum=0;
while ($questions) {
@@ -3151,6 +3302,7 @@ sub scantron_parse_scanline {
my (@array)=split(/$$scantron_config{'Qon'}/,$currentquest);
if (scalar(@array) gt 2) {
#FIXME do something intelligent with double bubbles
+ #actually not a concern right now, should be taking care of later
Apache->request->print("Wha!!! ".scalar(@array).
'-'.$currentquest.'-'.$questnum.' ');
}
@@ -3165,14 +3317,23 @@ sub scantron_parse_scanline {
}
sub scantron_add_delay {
+ my ($delayqueue,$scanline,$errormessage,$errorcode)=@_;
+ Apache->request->print('add_delay_error '.$_[2] );
+ push(@$delayqueue,
+ {'line' => $scanline, 'emsg' => $errormessage,
+ 'ecode' => $errorcode }
+ );
}
sub scantron_find_student {
my ($scantron_record,$idmap)=@_;
my $scanID=$$scantron_record{'scantron.ID'};
foreach my $id (keys(%$idmap)) {
- Apache->request->print('checking studnet -'.$id.'- againt -'.$scanID.'- ');
- if (lc($id) eq lc($scanID)) { Apache->request->print('success');return $$idmap{$id}; }
+ #Apache->request->print('checking studnet -'.$id.'- againt -'.$scanID.'- ');
+ if (lc($id) eq lc($scanID)) {
+ #Apache->request->print('success');
+ return $$idmap{$id};
+ }
}
return undef;
}
@@ -3185,6 +3346,137 @@ sub scantron_filter {
return 0;
}
+#FIXME I think I am doing this in the wrong order, I think it would be
+#better to make a several passes analyzing all of the lines in the
+#file for common errors wrong/invalid PID/username duplicated
+#PID/username, missing bubbles, double bubbles, missing/invalid CODE
+#and then get the instructor to fix all of these errors, then grade
+#the corrected one, I'll still need to catch error conditions, but
+#maybe most will taken care even before we start
+
+sub scantron_validate_file {
+ my ($r) = @_;
+ my ($symb,$url)=&get_symb_and_url($r);
+ if (!$symb) {return '';}
+ my $default_form_data=&defaultFormData($symb,$url);
+
+ if ($ENV{'form.scantron_corrections'}) {
+ &scantron_process_corrections($r);
+ }
+ #get the student pick code ready
+ $r->print(&Apache::loncommon::studentbrowser_javascript());
+ my $result= <
+
+
+
+
+ $default_form_data
+SCANTRONFORM
+ $r->print($result);
+
+ my @validate_phases=( 'ID',
+ 'CODE',
+ 'doublebubble',
+ 'missingbubbles');
+ if (!$ENV{'form.validatepass'}) {
+ $ENV{'form.valiadatepass'} = 0;
+ }
+ my $currentphase=$ENV{'form.valiadatepass'};
+
+ if ($ENV{'form.scantron_selectfile'}=~m-^/-) {
+ #first pass copy file to classdir
+
+ }
+ my $stop=0;
+ while (!$stop && $currentphase < scalar(@validate_phases)) {
+ my $which="scantron_validate_".$validate_phases[$currentphase];
+ {
+ no strict 'refs';
+ ($stop,$currentphase)=&$which($r,$currentphase);
+ }
+ }
+ $r->print(" ");
+}
+
+sub scantron_validate_ID {
+ my ($r,$currentphase) = @_;
+
+ #get student info
+ my $classlist=&Apache::loncoursedata::get_classlist();
+ my %idmap=&username_to_idmap($classlist);
+
+ #get scantron line setup
+ my %scantron_config=&get_scantron_config($ENV{'form.scantron_format'});
+ #my $scanlines=Apache::File->new($Apache::lonnet::perlvar{'lonScansDir'}."/$ENV{'form.scantron_selectfile'}");
+ #FIXME really would prefer a scantron directory but tokenwrapper
+ # doesn't allow access to subdirs of userfiles
+ my $scanlines=&Apache::lonnet::getfile('/uploaded/'.
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.'/'.
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.'/'.
+ 'scantron_'.$ENV{'form.scantron_selectfile'});
+
+ my @scanlines=split("\n",$scanlines);
+
+ my %found=('ids'=>{},'usernames'=>{});
+ foreach my $line (@scanlines) {
+ my $scan_record=&scantron_parse_scanline($line,\%scantron_config);
+ my $id=$$scan_record{'scantron.ID'};
+ $r->print("Checking ID ".$$scan_record{'scantron.ID'}."
\n");
+ my $found;
+ foreach my $checkid (keys(%idmap)) {
+ if (lc($checkid) eq lc($id)) {
+ if ($checkid ne $id) {
+ $r->print("Using $checkid for bubbled $id
\n");
+ }
+ $found=$checkid;last;
+ }
+ }
+ if ($found) {
+ if ($found{'ids'}{$found}) {
+ &scantron_get_ID_correction($r,$line,$scan_record,'duplicate',$found);
+ return(1);
+ } else {
+ $found{'ids'}{$found}++;
+ }
+ } else {
+ &scantron_get_ID_correction($r,$line,$scan_record,'incorrect');
+ return(1);
+ }
+ }
+
+ return (0,$currentphase+1);
+}
+
+sub scantron_get_ID_correction {
+ my ($r,$line,$scan_record,$error,$arg)=@_;
+ $r->print("need to correct ID
\n");
+ $r->print(' '."\n");
+ $r->print(' '."\n");
+ if ($error eq 'unknown') {
+ $r->print(" Unknown ID
\n");
+ } elsif ($error eq 'duplicate') {
+ $r->print(" Duplicated ID
\n");
+ }
+ $r->print("Original ID is ".$$scan_record{'scantron.ID'}."
\n");
+ $r->print("Name on paper is ".$$scan_record{'scantron.LastName'}.",".
+ $$scan_record{'scantron.FirstName'}."
");
+ $r->print("Corrected User -- ");
+ $r->print("\nusername: ");
+ $r->print("\ndomain:".
+ &Apache::loncommon::select_dom_form(undef,'scantron_domain'));
+ #FIXME it would be nice if this sent back the user ID and
+ #could do partial userID matches
+ $r->print(&Apache::loncommon::selectstudent_link('scantronupload',
+ 'scantron_username','scantron_domain'));
+ &scantron_end_validate_form($r);
+}
+
+sub scantron_end_validate_form {
+ my ($r) = @_;
+ $r->print(' ');
+}
+
sub scantron_process_students {
my ($r) = @_;
my (undef,undef,$sequence)=split(/___/,$ENV{'form.selectpage'});
@@ -3200,7 +3492,7 @@ sub scantron_process_students {
my $navmap=Apache::lonnavmaps::navmap->new($ENV{'request.course.fn'}.'.db',$ENV{'request.course.fn'}.'_parms.db',1, 1);
my $map=$navmap->getResourceByUrl($sequence);
my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
- $r->print("geto ".scalar(@resources)." ");
+# $r->print("geto ".scalar(@resources)." ");
my $result= <
@@ -3209,29 +3501,36 @@ SCANTRONFORM
$r->print($result);
my @delayqueue;
- my $totalcorrect;
- my $totalincorrect;
-
+ my %completedstudents;
+
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,
'Scantron Status','Scantron Progress',scalar(@scanlines));
+ &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
+ 'Processing first student');
+ my $start=&Time::HiRes::time();
foreach my $line (@scanlines) {
- my $studentcorrect;
- my $studentincorrect;
+ $r->print('line is'.$line.' ');
chomp($line);
my $scan_record=&scantron_parse_scanline($line,\%scantron_config);
my ($uname,$udom);
- if ($uname=&scantron_find_student($scan_record,\%idmap)) {
+ unless ($uname=&scantron_find_student($scan_record,\%idmap)) {
&scantron_add_delay(\@delayqueue,$line,
- 'Unable to find a student that matches');
+ 'Unable to find a student that matches',1);
+ next;
+ }
+ if (exists $completedstudents{$uname}) {
+ &scantron_add_delay(\@delayqueue,$line,
+ 'Student '.$uname.' has multiple sheets',2);
+ next;
}
$r->print('doing studnet'.$uname.' ');
($uname,$udom)=split(/:/,$uname);
&Apache::lonnet::delenv('form.counter');
&Apache::lonnet::appenv(%$scan_record);
# &Apache::lonhomework::showhash(%ENV);
- $Apache::lonxml::debug=1;
- &Apache::lonxml::debug("line is $line");
+# $Apache::lonxml::debug=1;
+# &Apache::lonxml::debug("line is $line");
my $i=0;
foreach my $resource (@resources) {
@@ -3243,31 +3542,31 @@ SCANTRONFORM
'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(''.
- $resource->symb().'-'.
- $resource->src().'-'.' result is'.$result);
- &Apache::lonhomework::showhash(%score);
+# 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(''.
+# $resource->symb().'-'.
+# $resource->src().'-'.' result is'.$result);
+# &Apache::lonhomework::showhash(%score);
# if ($i eq 3) {last;}
}
+ $completedstudents{$uname}={'line'=>$line};
+ } continue {
&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;
+ 'last student');
+ #last;
#FIXME
#get iterator for $sequence
#foreach question 'submit' the students answer to the server
@@ -3275,7 +3574,11 @@ SCANTRONFORM
# generate data to pass back that includes grade recevied
#}
}
- $Apache::lonxml::debug=0;
+ &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
+ my $lasttime = &Time::HiRes::time()-$start;
+ $r->print("took $lasttime
");
+
+ #$Apache::lonxml::debug=0;
foreach my $delay (@delayqueue) {
#FIXME
#print out each delayed student with interface to select how
@@ -3301,7 +3604,7 @@ SCANTRONFORM
#--- Show a Grading Menu button - Calls the next routine ---
sub show_grading_menu_form {
my ($symb,$url)=@_;
- my $result.='