Part '.
$partid.' ( ID '.$respid.
@@ -1456,7 +1592,7 @@ KEYWORDS
'Nothing submitted - no attempts
';
} else {
foreach (@$string) {
- my ($partid,$respid) = /^resource\.(\w+)\.(\w+)\.submission/;
+ my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/;
if ($part eq ($partid.'_'.$respid)) {
my ($ressub,$subval) = split(/:/,$_,2);
# Similarity check
@@ -1476,6 +1612,7 @@ KEYWORDS
&keywords_highlight($oessay).' ';
}
}
+ my $order=&get_order($partid,$respid,$symb,$uname,$udom);
$lastsubonly.='Part '.
$partid.' ( ID '.$respid.
' ) '.
@@ -1486,11 +1623,11 @@ KEYWORDS
'Like all files provided by users, '.
'this file may contain virusses ':'').
'Submitted Answer: '.
- &cleanRecord($subval,$responsetype,$symb).
+ &cleanRecord($subval,$responsetype,$symb,$partid,$respid,\%record,$order).
'
'.$similar."\n"
if ($ENV{'form.lastSub'} eq 'lastonly' ||
($ENV{'form.lastSub'} eq 'hdgrade' &&
- $$handgrade{$part} =~ /:yes$/));
+ $$handgrade{$part} eq 'yes'));
}
}
}
@@ -1498,10 +1635,9 @@ KEYWORDS
}
$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));
+ $request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
} elsif ($ENV{'form.lastSub'} =~ /^(last|all)$/) {
$request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
$ENV{'request.course.id'},
@@ -1674,18 +1810,27 @@ 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);
+ &Apache::lonnet::logthis('collab '.(join(':',@{ $ENV{'form.collaborator'.$ctr} })));
+ 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);
+ }
+
}
}
}
@@ -1789,15 +1934,25 @@ sub processHandGrade {
}
$ctr = 0;
@parsedlist = reverse @parsedlist if ($button eq 'Previous');
+ my ($partlist) = &response_type($url);
foreach my $student (@parsedlist) {
+ my $submitonly=$ENV{'form.submitonly'};
my ($uname,$udom) = split(/:/,$student);
- if ($ENV{'form.submitonly'} eq 'yes') {
- my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
- my $statusflg = '';
- foreach (split(/:/,$ENV{'form.gradePartRespid'})){
- $statusflg = 1 if (exists ($record{'resource.'.$_.'.submission'}));
+ if ($submitonly =~ /^(yes|graded)$/) {
+# my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
+ my %status=&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
+ my $submitted = 0;
+ my $graded = 1;
+ foreach (keys(%status)) {
+ $submitted = 1 if ($status{$_} ne 'nothing');
+ $graded = 0 if ($status{$_} =~ /^correct/);
+ my ($foo,$partid,$foo1) = split(/\./,$_);
+ if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
+ $submitted = 0;
+ }
}
- next if ($statusflg eq '');
+ next if (!$submitted && ($submitonly eq 'yes' || $submitonly eq 'graded'));
+ next if (!$graded && $submitonly eq 'graded');
}
push @nextlist,$student if ($ctr < $ntstu);
last if ($ctr == $ntstu);
@@ -1827,7 +1982,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'); }
@@ -1835,6 +1990,9 @@ sub saveHandGrade {
my %newrecord = ();
my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
+ &Apache::lonnet::logthis("-$submitter-$stuname-$part-$_");
+ #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') {
@@ -1870,6 +2028,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'}";
@@ -2097,7 +2256,7 @@ sub viewgrades {
my ($partid,$respid) = split (/_/,$_,2);
next if $seen{$partid};
$seen{$partid}++;
- my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
+ my $handgrade=$$handgrade{$_};
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb);
$weight{$partid} = $wgt eq '' ? '1' : $wgt;
@@ -2139,7 +2298,7 @@ sub viewgrades {
$result.= ''."\n".
' No. | '.
''.&nameUserString('header')." | \n";
- my (@parts) = sort(&getpartlist($url));
+ my (@parts) = sort(&getpartlist($url,$symb));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
$display =~ s|^Number of Attempts|Tries |; # makes the column narrower
@@ -2256,7 +2415,7 @@ sub editgrades {
my %columns = ();
my ($i,$ctr,$count,$rec_update) = (0,0,0,0);
- my (@parts) = sort(&getpartlist($url));
+ my (@parts) = sort(&getpartlist($url,$symb));
my $header;
while ($ctr < $ENV{'form.totalparts'}) {
my $partid = $ENV{'form.partid_'.$ctr};
@@ -2334,18 +2493,17 @@ sub editgrades {
$newrecord{'resource.'.$_.'.awarded'} = 0;
$newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
$updateflag = 1;
+ } elsif (!($old_part eq $partial && $old_score eq $score)) {
+ $updateflag = 1;
+ $newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne '';
+ $newrecord{'resource.'.$_.'.solved'} = $score;
+ $rec_update++;
}
$line .= ''.$old_aw.' | '.
''.$awarded.
($score eq 'excused' ? $score : '').' | ';
- if (!($old_part eq $partial && $old_score eq $score)) {
- $updateflag = 1;
- $newrecord{'resource.'.$_.'.awarded'} = $partial if $partial ne '';
- $newrecord{'resource.'.$_.'.solved'} = $score;
- $rec_update++;
- }
my $partid=$_;
foreach my $stores (@parts) {
@@ -2522,8 +2680,8 @@ ENDPICK
}
sub csvupload_fields {
- my ($url) = @_;
- my (@parts) = &getpartlist($url);
+ my ($url,$symb) = @_;
+ my (@parts) = &getpartlist($url,$symb);
my @fields=(['username','Student Username'],['domain','Student Domain']);
foreach my $part (sort(@parts)) {
my @datum;
@@ -2606,7 +2764,7 @@ sub csvuploadmap {
&csvuploadmap_header($request,$symb,$url,$datatoken,$#records+1);
my ($i,$keyfields);
if (@records) {
- my @fields=&csvupload_fields($url);
+ my @fields=&csvupload_fields($url,$symb);
if ($ENV{'form.upfile_associate'} eq 'reverse') {
&Apache::loncommon::csv_print_samples($request,\@records);
@@ -2733,7 +2891,9 @@ LISTJAVASCRIPT
$result.='
|
| |