--- loncom/homework/grades.pm 2003/11/07 08:56:52 1.148
+++ loncom/homework/grades.pm 2003/11/07 19:25:26 1.152
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.148 2003/11/07 08:56:52 albertel Exp $
+# $Id: grades.pm,v 1.152 2003/11/07 19:25:26 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -189,8 +189,7 @@ sub get_order {
('grade_courseid' =>
$ENV{'request.course.id'}),
('grade_username' => $uname));
- (my $debug,$subresult)=split(/_HASH_REF__/,$subresult,2);
- Apache->request->print($debug);
+ (undef,$subresult)=split(/_HASH_REF__/,$subresult,2);
my %analyze=&Apache::lonnet::str2hash($subresult);
return ($analyze{"$partid.$respid.shown"});
}
@@ -666,8 +665,9 @@ LISTJAVASCRIPT
my ($foo,$partid,$foo1) = split(/\./,$_);
if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
$submitted = 0;
+ my ($part)=split(/\./,$partid);
$gradeTable.='';
}
}
@@ -1533,8 +1533,10 @@ KEYWORDS
$result.=$$fullname{$_}.' ';
}
$result.='
'."\n";
+ my ($part)=split(/\./,$_);
$result.=''."\n";
+ '" value="'.$part.':'.(join ':',@goodcollaborators).'" />'.
+ "\n";
}
if (scalar(@badcollaborators) > 0) {
$result.='
'; @@ -1560,76 +1562,75 @@ KEYWORDS # (3) Last submission plus the parts info # (4) The whole record for this student if ($ENV{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) { - if ($ENV{'form.'.$uname.':'.$udom.':submitted_by'}) { - my $submitby=''. - 'Collaborative submission by: '. - ''. - $$fullname{$ENV{'form.'.$uname.':'.$udom.':submitted_by'}}.''; - $request->print($submitby); + my ($string,$timestamp)= &get_last_submission(\%record); + my $lastsubonly=''. + ($$timestamp eq '' ? '' : 'Date Submitted: '. + $$timestamp)." |
'.$$string[0]; } else { - my ($string,$timestamp)= &get_last_submission(\%record); - my $lastsubonly=''. - ($$timestamp eq '' ? '' : 'Date Submitted: '. - $$timestamp)." |
'.$$string[0];
- } else {
- for my $part (sort keys(%$handgrade)) {
- my ($partid,$respid) = split(/_/,$part);
- my $responsetype = $responseType->{$partid}->{$respid};
- if (!exists($record{'resource.'.$partid.'.'.$respid.'.submission'})) {
+ my %seenparts;
+ for my $part (sort keys(%$handgrade)) {
+ my ($partid,$respid) = split(/_/,$part);
+ if ($ENV{"form.$uname:$udom:$partid:submitted_by"}) {
+ if (exists($seenparts{$partid})) { next; }
+ $seenparts{$partid}=1;
+ my $submitby='Part '.$partid.
+ ' Collaborative submission by: '.
+ ''.
+ $$fullname{$ENV{"form.$uname:$udom:$partid:submitted_by"}}.' '; + $request->print($submitby); + next; + } + my $responsetype = $responseType->{$partid}->{$respid}; + if (!exists($record{"resource.$partid.$respid.submission"})) { + $lastsubonly.=' |
Part '.
+ $partid.' ( ID '.$respid.
+ ' ) '.
+ 'Nothing submitted - no attempts '; + next; + } + foreach (@$string) { + my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; + if ($part ne ($partid.'_'.$respid)) { next; } + my ($ressub,$subval) = split(/:/,$_,2); + # Similarity check + my $similar=''; + if($ENV{'form.checkPlag'}){ + my ($oname,$odom,$ocrsid,$oessay,$osim)= + &most_similar($uname,$udom,$subval); + if ($osim) { + $osim=int($osim*100.0); + $similar=" Essay". + " is $osim% similar to an essay by ". + &Apache::loncommon::plainname($oname,$odom). + ''. + &keywords_highlight($oessay). + ' '; + } + } + my $order=&get_order($partid,$respid,$symb,$uname,$udom); + if ($ENV{'form.lastSub'} eq 'lastonly' || + ($ENV{'form.lastSub'} eq 'hdgrade' && + $$handgrade{$part} eq 'yes')) { $lastsubonly.=' |
Part '.
$partid.' ( ID '.$respid.
- ' ) '.
- 'Nothing submitted - no attempts '; - } else { - foreach (@$string) { - my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/; - if ($part eq ($partid.'_'.$respid)) { - my ($ressub,$subval) = split(/:/,$_,2); - # Similarity check - my $similar=''; - my $oname; - my $odom; - my $ocrsid; - my $oessay; - my $osim; - if($ENV{'form.checkPlag'}){ - ($oname,$odom,$ocrsid,$oessay,$osim)=&most_similar($uname,$udom,$subval); - if ($osim) { - $osim=int($osim*100.0); - $similar=' Essay is '.$osim. - '% similar to an essay by '.&Apache::loncommon::plainname($oname,$odom). - ''. - &keywords_highlight($oessay).' '; - } - } - my $order=&get_order($partid,$respid,$symb,$uname,$udom); - $lastsubonly.=' |
Part '.
- $partid.' ( ID '.$respid.
- ' ) '.
- ($record{"resource.$partid.$respid.uploadedurl"}?
- ' File uploaded by student '.
- 'Like all files provided by users, '.
- 'this file may contain virusses ':''). - 'Submitted Answer: '. - &cleanRecord($subval,$responsetype,$symb,$partid,$respid,\%record,$order). - ' '.$similar."\n" - if ($ENV{'form.lastSub'} eq 'lastonly' || - ($ENV{'form.lastSub'} eq 'hdgrade' && - $$handgrade{$part} =~ /:yes$/)); - } + ' ) '; + if ($record{"resource.$partid.$respid.uploadedurl"}) { + $lastsubonly.=' File uploaded by student Like all files provided by users, this file may contain virusses '; } + $lastsubonly.='Submitted Answer: '. + &cleanRecord($subval,$responsetype,$symb,$partid, + $respid,\%record,$order); + if ($similar) {$lastsubonly.=" $similar\n";} } } } - $lastsubonly.=' |
'."\n"; - $request->print($lastsubonly); } + $lastsubonly.=' |
'."\n";
+ $request->print($lastsubonly);
} elsif ($ENV{'form.lastSub'} eq 'datesub') {
my (undef,$responseType,undef,$parts) = &showResourceInfo($url);
$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
@@ -1805,18 +1806,26 @@ sub processHandGrade {
$ENV{'form.msgsub'},$message);
}
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});
- if ($errorflag eq 'not_allowed') {
- $request->print("Not allowed to modify grades for $_:$udom");
- next;
- } else {
- if ($message ne '') {
- $msgstatus = &Apache::lonmsg::user_normal_msg ($_,$udom,
- $ENV{'form.msgsub'},
- $message);
+ my @collabstrs;
+ if (ref($ENV{'form.collaborator'.$ctr}) eq 'ARRAY') {
+ @collabstrs=@{$ENV{'form.collaborator'.$ctr}};
+ } else {
+ @collabstrs=$ENV{'form.collaborator'.$ctr};
+ }
+ foreach my $collabstr (@collabstrs) {
+ my ($part,@collaborators) = split(/:/,$collabstr);
+ foreach (@collaborators) {
+ my ($errorflag,$pts,$wgt) =
+ &saveHandGrade($request,$url,$symb,$_,$udom,$ctr,
+ $ENV{'form.unamedom'.$ctr},$part);
+ if ($errorflag eq 'not_allowed') {
+ $request->print("Not allowed to modify grades for $_:$udom");
+ next;
+ } else {
+ if ($message ne '') {
+ $msgstatus = &Apache::lonmsg::user_normal_msg($_,$udom,$ENV{'form.msgsub'},$message);
+ }
+
}
}
}
@@ -1968,7 +1977,7 @@ sub processHandGrade {
#---- Save the score and award for each student, if changed
sub saveHandGrade {
- my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_;
+ my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_;
my $usec = &Apache::lonnet::getsection($domain,$stuname,
$ENV{'request.course.id'});
if (!&canmodify($usec)) { return('not_allowed'); }
@@ -1976,6 +1985,8 @@ sub saveHandGrade {
my %newrecord = ();
my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
+ #collaborator may vary for different parts
+ if ($submitter && $_ ne $part) { next; }
my $dropMenu = $ENV{'form.GD_SEL'.$newflg.'_'.$_};
if ($dropMenu eq 'excused') {
if ($record{'resource.'.$_.'.solved'} ne 'excused') {
@@ -2011,6 +2022,7 @@ sub saveHandGrade {
$newrecord{$reckey} = 'correct_by_override'
if ($record{$reckey} ne 'correct_by_override');
}
+
$newrecord{'resource.'.$_.'.submitted_by'} = $submitter
if ($submitter && ($record{'resource.'.$_.'.submitted_by'} ne $submitter));
$newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
@@ -3926,6 +3938,11 @@ sub send_header {
#remotewindow.close();
#");
$request->print(&Apache::loncommon::bodytag('Grading'));
+ foreach my $key (sort(keys(%ENV))) {
+ if ($key =~ /^form\./) {
+ Apache->request->print("$key => $ENV{$key} "); + } + } } sub send_footer { |