[LON-CAPA-cvs] cvs: loncom /homework grades.pm
raeburn
raeburn at source.lon-capa.org
Sun Dec 31 09:00:42 EST 2017
raeburn Sun Dec 31 14:00:42 2017 EDT
Modified files:
/loncom/homework grades.pm
Log:
- Bug 6754 LON-CAPA as LTI Consumer
- For external tools set to be gradable, grading table from
&displaySubByDates() includes values awarded instead of submissions.
-------------- next part --------------
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.748 loncom/homework/grades.pm:1.749
--- loncom/homework/grades.pm:1.748 Sun Dec 31 13:29:53 2017
+++ loncom/homework/grades.pm Sun Dec 31 14:00:41 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.748 2017/12/31 13:29:53 raeburn Exp $
+# $Id: grades.pm,v 1.749 2017/12/31 14:00:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5033,7 +5033,9 @@
'</td>';
$studentTable.='<td valign="top">';
my %form = ('CODE' => $env{'form.CODE'},);
- unless ($is_tool) {
+ if ($is_tool) {
+ $studentTable.=' <b>'.$title.'</b><br />';
+ } else {
if ($env{'form.vProb'} eq 'yes' ) {
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
undef,'both',\%form);
@@ -5118,7 +5120,7 @@
'<th>'.&mt('Date/Time').'</th>'.
($isCODE?'<th>'.&mt('CODE').'</th>':'').
($isTask?'<th>'.&mt('Version').'</th>':'').
- '<th>'.&mt('Submission').'</th>'.
+ '<th>'.($is_tool?&mt('Grade'):&mt('Submission')).'</th>'.
'<th>'.&mt('Status').'</th>'.
&Apache::loncommon::end_data_table_header_row();
my ($version);
@@ -5163,56 +5165,64 @@
if (($type eq 'anonsurvey') || ($type eq 'anonsurveycred')) {
$hidden = 1;
}
- my @matchKey = ($isTask ? sort(grep /^resource\.\d+\.\Q$partid\E\.award$/, at versionKeys)
- : sort(grep /^resource\.\Q$partid\E\..*?\.submission$/, at versionKeys));
-
+ my @matchKey;
+ if ($isTask) {
+ @matchKey = sort(grep /^resource\.\d+\.\Q$partid\E\.award$/, at versionKeys);
+ } elsif ($is_tool) {
+ @matchKey = sort(grep /^resource\.\Q$partid\E\.awarded$/, at versionKeys);
+ } else {
+ @matchKey = sort(grep /^resource\.\Q$partid\E\..*?\.submission$/, at versionKeys);
+ }
# next if ($$record{"$version:resource.$partid.solved"} eq '');
my $display_part=&get_display_part($partid,$symb);
foreach my $matchKey (@matchKey) {
if (exists($$record{$version.':'.$matchKey}) &&
$$record{$version.':'.$matchKey} ne '') {
-
- my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
- : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
- $displaySub[0].='<span class="LC_nobreak">';
- $displaySub[0].='<b>'.&mt('Part: [_1]',$display_part).'</b>'
- .' <span class="LC_internal_info">'
- .'('.&mt('Response ID: [_1]',$responseId).')'
- .'</span>'
- .' <b>';
- if ($hidden) {
- $displaySub[0].= &mt('Anonymous Survey').'</b>';
+ if ($is_tool) {
+ $displaySub[0].=$$record{"$version:resource.$partid.awarded"};
} else {
- my ($trial,$rndseed,$newvariation);
- if ($type eq 'randomizetry') {
- $trial = $$record{"$where.$partid.tries"};
- $rndseed = $$record{"$where.$partid.rndseed"};
- }
- if ($$record{"$where.$partid.tries"} eq '') {
- $displaySub[0].=&mt('Trial not counted');
- } else {
- $displaySub[0].=&mt('Trial: [_1]',
- $$record{"$where.$partid.tries"});
- if (($rndseed ne '') && ($lastrndseed{$partid} ne '')) {
- if (($rndseed ne $lastrndseed{$partid}) &&
- (($type eq 'randomizetry') || ($lasttype{$partid} eq 'randomizetry'))) {
- $newvariation = ' ('.&mt('New variation this try').')';
- }
+ my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
+ : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
+ $displaySub[0].='<span class="LC_nobreak">';
+ $displaySub[0].='<b>'.&mt('Part: [_1]',$display_part).'</b>'
+ .' <span class="LC_internal_info">'
+ .'('.&mt('Response ID: [_1]',$responseId).')'
+ .'</span>'
+ .' <b>';
+ if ($hidden) {
+ $displaySub[0].= &mt('Anonymous Survey').'</b>';
+ } else {
+ my ($trial,$rndseed,$newvariation);
+ if ($type eq 'randomizetry') {
+ $trial = $$record{"$where.$partid.tries"};
+ $rndseed = $$record{"$where.$partid.rndseed"};
}
- $lastrndseed{$partid} = $rndseed;
- $lasttype{$partid} = $type;
- }
- my $responseType=($isTask ? 'Task'
+ if ($$record{"$where.$partid.tries"} eq '') {
+ $displaySub[0].=&mt('Trial not counted');
+ } else {
+ $displaySub[0].=&mt('Trial: [_1]',
+ $$record{"$where.$partid.tries"});
+ if (($rndseed ne '') && ($lastrndseed{$partid} ne '')) {
+ if (($rndseed ne $lastrndseed{$partid}) &&
+ (($type eq 'randomizetry') || ($lasttype{$partid} eq 'randomizetry'))) {
+ $newvariation = ' ('.&mt('New variation this try').')';
+ }
+ }
+ $lastrndseed{$partid} = $rndseed;
+ $lasttype{$partid} = $type;
+ }
+ my $responseType=($isTask ? 'Task'
: $responseType->{$partid}->{$responseId});
- if (!exists($orders{$partid})) { $orders{$partid}={}; }
- if ((!exists($orders{$partid}->{$responseId})) || ($trial)) {
- $orders{$partid}->{$responseId}=
- &get_order($partid,$responseId,$symb,$uname,$udom,
- $no_increment,$type,$trial,$rndseed);
- }
- $displaySub[0].='</b>'.$newvariation.'</span>'; # /nobreak
- $displaySub[0].=' '.
- &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).'<br />';
+ if (!exists($orders{$partid})) { $orders{$partid}={}; }
+ if ((!exists($orders{$partid}->{$responseId})) || ($trial)) {
+ $orders{$partid}->{$responseId}=
+ &get_order($partid,$responseId,$symb,$uname,$udom,
+ $no_increment,$type,$trial,$rndseed);
+ }
+ $displaySub[0].='</b>'.$newvariation.'</span>'; # /nobreak
+ $displaySub[0].=' '.
+ &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).'<br />';
+ }
}
}
}
@@ -5227,14 +5237,22 @@
lc($$record{"$where.$partid.award"}).' '.
$mark{$$record{"$where.$partid.solved"}}.
'<br />';
+ } elsif (($is_tool) && (exists($$record{"$version:resource.$partid.solved"}))) {
+ if ($$record{"$version:resource.$partid.solved"} =~ /^(in|)correct_by_passback$/) {
+ $displaySub[1].=&mt('Grade passed back by external tool');
+ }
}
if (exists $$record{"$where.$partid.regrader"}) {
- $displaySub[2].=$$record{"$where.$partid.regrader"}.
- ' (<b>'.&mt('Part').':</b> '.$display_part.')';
+ $displaySub[2].=$$record{"$where.$partid.regrader"};
+ unless ($is_tool) {
+ $displaySub[2].=' (<b>'.&mt('Part').':</b> '.$display_part.')';
+ }
} elsif ($$record{"$version:resource.$partid.regrader"} =~ /\S/) {
$displaySub[2].=
- $$record{"$version:resource.$partid.regrader"}.
- ' (<b>'.&mt('Part').':</b> '.$display_part.')';
+ $$record{"$version:resource.$partid.regrader"};
+ unless ($is_tool) {
+ $displaySub[2].=' (<b>'.&mt('Part').':</b> '.$display_part.')';
+ }
}
}
# needed because old essay regrader has not parts info
More information about the LON-CAPA-cvs
mailing list