'."\n";
- if (($numresp > $numessay) && !$is_tool) {
+ if ($numresp > $numessay) {
$result.='
'
.&mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon)
."
\n";
@@ -2557,12 +2523,176 @@ sub submission {
# (3) All transactions (by date)
# (4) The whole record (with detailed information for all transactions)
- my ($lastsubonly,$partinfo) =
- &show_last_submission($uname,$udom,$symb,$essayurl,$responseType,$env{'form.lastSub'},
- $is_tool,$fullname,\%record,\%coursedesc_by_cid);
- $request->print($partinfo);
- $request->print($lastsubonly);
+ my ($string,$timestamp,$lastgradetime,$lastsubmittime) =
+ &get_last_submission(\%record);
+
+ my $lastsubonly;
+
+ if ($timestamp eq '') {
+ $lastsubonly.='
';
+ } else {
+ my ($shownsubmdate,$showngradedate);
+ if ($lastsubmittime && $lastgradetime) {
+ $shownsubmdate = &Apache::lonlocal::locallocaltime($lastsubmittime);
+ if ($lastgradetime > $lastsubmittime) {
+ $showngradedate = &Apache::lonlocal::locallocaltime($lastgradetime);
+ }
+ } else {
+ $shownsubmdate = $timestamp;
+ }
+ $lastsubonly =
+ '
'."\n"; # End: LC_grade_submissions_body
+ }
+ $request->print($lastsubonly);
if ($env{'form.lastSub'} eq 'datesub') {
my ($parts,$handgrade,$responseType) = &response_type($symb,\$res_error);
$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
@@ -2615,12 +2745,7 @@ sub submission {
my %seen = ();
my @partlist;
my @gradePartRespid;
- my @part_response_id;
- if ($is_tool) {
- @part_response_id = ([0,'']);
- } else {
- @part_response_id = &flatten_responseType($responseType);
- }
+ my @part_response_id = &flatten_responseType($responseType);
$request->print(
'
'
.'
'.&mt('Assign Grades').'
'
@@ -2686,186 +2811,6 @@ sub submission {
return '';
}
-sub show_last_submission {
- my ($uname,$udom,$symb,$essayurl,$responseType,$viewtype,$is_tool,$fullname,
- $record,$coursedesc_by_cid) = @_;
- my ($string,$timestamp,$lastgradetime,$lastsubmittime) =
- &get_last_submission($record,$is_tool);
-
- my ($lastsubonly,$partinfo);
- if ($timestamp eq '') {
- $lastsubonly.='
'.$string->[0].'
';
- } elsif ($is_tool) {
- $lastsubonly =
- '
'
- .''.&mt('Date Grade Passed Back:').' '.$timestamp."
\n";
- } else {
- my ($shownsubmdate,$showngradedate);
- if ($lastsubmittime && $lastgradetime) {
- $shownsubmdate = &Apache::lonlocal::locallocaltime($lastsubmittime);
- if ($lastgradetime > $lastsubmittime) {
- $showngradedate = &Apache::lonlocal::locallocaltime($lastgradetime);
- }
- } else {
- $shownsubmdate = $timestamp;
- }
- $lastsubonly =
- '
'
- .'
'.&mt('Date Submitted:').' '.$shownsubmdate."\n";
- if ($showngradedate) {
- $lastsubonly .= '
'.&mt('Date Graded:').' '.$showngradedate."\n";
- }
-
- my %seenparts;
- my @part_response_id = &flatten_responseType($responseType);
- foreach my $part (@part_response_id) {
- my ($partid,$respid) = @{ $part };
- my $display_part=&get_display_part($partid,$symb);
- if ($env{"form.$uname:$udom:$partid:submitted_by"}) {
- if (exists($seenparts{$partid})) { next; }
- $seenparts{$partid}=1;
- $partinfo .=
- '
'.&mt('Part: [_1]',$display_part).''.
- '
'.&mt('Collaborative submission by: [_1]',
- ''.
- $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'').
- '
';
- next;
- }
- my $responsetype = $responseType->{$partid}->{$respid};
- if (!exists($record->{"resource.$partid.$respid.submission"})) {
- $lastsubonly.="\n".''.
- ''.&mt('Part: [_1]',$display_part).''.
- ' '.
- '('.&mt('Response ID: [_1]',$respid).')'.
- ' '.
- ''.&mt('Nothing submitted - no attempts.').'
';
- next;
- }
- foreach my $submission (@$string) {
- my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
- if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
- my ($ressub,$hide,$draft,$subval) = split(/:/,$submission,4);
- # Similarity check
- my $similar='';
- my ($type,$trial,$rndseed);
- if ($hide eq 'rand') {
- $type = 'randomizetry';
- $trial = $record->{"resource.$partid.tries"};
- $rndseed = $record->{"resource.$partid.rndseed"};
- }
- if ($env{'form.checkPlag'}) {
- my ($oname,$odom,$ocrsid,$oessay,$osim)=
- &most_similar($uname,$udom,$symb,$subval);
- if ($osim) {
- $osim=int($osim*100.0);
- if ($hide eq 'anon') {
- $similar='
'.&mt("Essay was found to be similar to another essay submitted for this assignment.").'
'.
- &mt('As the current submission is for an anonymous survey, no other details are available.').'
';
- } else {
- $similar='
';
- if ($essayurl eq 'lib/templates/simpleproblem.problem') {
- $similar .= ''.
- &mt('Essay is [_1]% similar to an essay by [_2]',
- $osim,
- &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')').
- '
';
- } else {
- my %old_course_desc;
- if ($ocrsid ne '') {
- if (ref($coursedesc_by_cid->{$ocrsid}) eq 'HASH') {
- %old_course_desc = %{$coursedesc_by_cid->{$ocrsid}};
- } else {
- my $args;
- if ($ocrsid ne $env{'request.course.id'}) {
- $args = {'one_time' => 1};
- }
- %old_course_desc =
- &Apache::lonnet::coursedescription($ocrsid,$args);
- $coursedesc_by_cid->{$ocrsid} = \%old_course_desc;
- }
- $similar .=
- ''.
- &mt('Essay is [_1]% similar to an essay by [_2] in course [_3] (course id [_4]:[_5])',
- $osim,
- &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')',
- $old_course_desc{'description'},
- $old_course_desc{'num'},
- $old_course_desc{'domain'}).
- '
';
- } else {
- $similar .=
- ''.
- &mt('Essay is [_1]% similar to an essay by [_2] in an unknown course',
- $osim,
- &Apache::loncommon::plainname($oname,$odom).' ('.$oname.':'.$odom.')').
- '
';
- }
- }
- $similar .= ''.
- &keywords_highlight($oessay).
- '
';
- }
- }
- }
- my $order=&get_order($partid,$respid,$symb,$uname,$udom,
- undef,$type,$trial,$rndseed);
- if (($viewtype eq 'lastonly') ||
- ($viewtype eq 'datesub') ||
- ($viewtype =~ /^(last|all)$/)) {
- my $display_part=&get_display_part($partid,$symb);
- $lastsubonly.=''.
- '
'.&mt('Part: [_1]',$display_part).''.
- '
'.
- '('.&mt('Response ID: [_1]',$respid).')'.
- ' ';
- my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record);
- if (@$files) {
- if ($hide eq 'anon') {
- $lastsubonly.='
'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
- } else {
- $lastsubonly.='
'.'
'.&mt('Submitted Files:').''
- .'
';
- if(@$files == 1) {
- $lastsubonly .= &mt('Like all files provided by users, this file may contain viruses!');
- } else {
- $lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!');
- }
- $lastsubonly .= '';
- foreach my $file (@$files) {
- &Apache::lonnet::allowuploaded('/adm/grades',$file);
- $lastsubonly.='
'.$file.'';
- }
- }
- $lastsubonly.='
';
- }
- if ($hide eq 'anon') {
- $lastsubonly.='
'.&mt('Anonymous Survey').'';
- } else {
- $lastsubonly.='
'.&mt('Submitted Answer:').' ';
- if ($draft) {
- $lastsubonly.= '
'.&mt('Draft Copy').'';
- }
- $subval =
- &cleanRecord($subval,$responsetype,$symb,$partid,
- $respid,$record,$order,undef,$uname,$udom,$type,$trial,$rndseed);
- if ($responsetype eq 'essay') {
- $subval =~ s{\n}{
}g;
- }
- $lastsubonly.=$subval."\n";
- }
- if ($similar) {$lastsubonly.="
$similar\n";}
- $lastsubonly.='
';
- }
- }
- }
- $lastsubonly.=''."\n"; # End: LC_grade_submissions_body
- }
- return ($lastsubonly,$partinfo);
-}
-
sub check_collaborators {
my ($symb,$uname,$udom,$record,$handgrade,$counter) = @_;
my ($result,@col_fullnames);
@@ -2924,7 +2869,7 @@ sub check_collaborators {
#--- Retrieve the last submission for all the parts
sub get_last_submission {
- my ($returnhash,$is_tool)=@_;
+ my ($returnhash)=@_;
my (@string,$timestamp,$lastgradetime,$lastsubmittime);
if ($$returnhash{'version'}) {
my %lasthash=();
@@ -2951,7 +2896,7 @@ sub get_last_submission {
$prevsolved{$1} = $solved{$1};
$solved{$1} = $lasthash{$key};
}
- }
+ }
foreach my $partid (keys(%handgraded)) {
if (($prevsolved{$partid} eq 'ungraded_attempted') &&
(($solved{$partid} eq 'incorrect_by_override') ||
@@ -2962,9 +2907,14 @@ sub get_last_submission {
$prevsolved{$partid} = $solved{$partid};
}
}
- $timestamp =
- &Apache::lonlocal::locallocaltime($$returnhash{$version.':timestamp'});
}
+#
+# Timestamp is for last transaction for this resource, which does not
+# necessarily correspond to the time of last submission for problem (or part).
+#
+ if ($lasthash{'timestamp'} ne '') {
+ $timestamp = &Apache::lonlocal::locallocaltime($lasthash{'timestamp'});
+ }
my (%typeparts,%randombytry);
my $showsurv =
&Apache::lonnet::allowed('vas',$env{'request.course.id'});
@@ -3018,14 +2968,8 @@ sub get_last_submission {
}
}
if (!@string) {
- my $msg;
- if ($is_tool) {
- $msg = &mt('No grade passed back.');
- } else {
- $msg = &mt('Nothing submitted - no attempts.');
- }
$string[0] =
- '
'.$msg.'';
+ '
'.&mt('Nothing submitted - no attempts.').'';
}
return (\@string,$timestamp,$lastgradetime,$lastsubmittime);
}
@@ -3862,8 +3806,8 @@ sub version_portfiles {
$$record{$key} = join(',',@versioned_portfiles);
push(@returned_keys,$key);
}
- }
- return (@returned_keys);
+ }
+ return (@returned_keys);
}
sub get_next_version {
@@ -4101,11 +4045,6 @@ VIEWJAVASCRIPT
#--- show scores for a section or whole class w/ option to change/update a score
sub viewgrades {
my ($request,$symb) = @_;
- my ($is_tool,$toolsymb);
- if ($symb =~ /ext\.tool$/) {
- $is_tool = 1;
- $toolsymb = $symb;
- }
&viewgrades_js($request);
#need to make sure we have the correct data for later EXT calls,
@@ -4205,13 +4144,7 @@ sub viewgrades {
if ($env{'form.submitonly'} eq 'all') {
$result.= '
'.$common_header.'
';
} else {
- my $text;
- if ($is_tool) {
- $text = &mt('(transaction status: "[_1]")',$submission_status);
- } else {
- $text = &mt('(submission status: "[_1]")',$submission_status);
- }
- $result.= '
'.$common_header.' '.$text.'
';
+ $result.= '
'.$common_header.' '.&mt('(submission status: "[_1]")',$submission_status).'
';
}
$result .= &Apache::loncommon::start_data_table();
#radio buttons/text box for assigning points for a section or class.
@@ -4224,12 +4157,7 @@ sub viewgrades {
my %weight = ();
my $ctsparts = 0;
my %seen = ();
- my @part_response_id;
- if ($is_tool) {
- @part_response_id = ([0,'']);
- } else {
- @part_response_id = &flatten_responseType($responseType);
- }
+ my @part_response_id = &flatten_responseType($responseType);
foreach my $part_response_id (@part_response_id) {
my ($partid,$respid) = @{ $part_response_id };
my $part_resp = join('_',@{ $part_response_id });
@@ -4280,16 +4208,10 @@ sub viewgrades {
#table listing all the students in a section/class
#header of table
- if ($env{'form.submitonly'} eq 'all') {
+ if ($env{'form.submitonly'} eq 'all') {
$result.= '
'.$specific_header.'
';
} else {
- my $text;
- if ($is_tool) {
- $text = &mt('(transaction status: "[_1]")',$submission_status);
- } else {
- $text = &mt('(submission status: "[_1]")',$submission_status);
- }
- $result.= '
'.$specific_header.' '.$text.'
';
+ $result.= '
'.$specific_header.' '.&mt('(submission status: "[_1]")',$submission_status).'
';
}
$result.= &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
@@ -4303,10 +4225,10 @@ sub viewgrades {
my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
my @partids = ();
foreach my $part (@parts) {
- my $display=&Apache::lonnet::metadata($url,$part.'.display',$toolsymb);
+ my $display=&Apache::lonnet::metadata($url,$part.'.display');
my $narrowtext = &mt('Tries');
$display =~ s|^Number of Attempts|$narrowtext
|; # makes the column narrower
- if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name',$toolsymb); }
+ if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
my ($partid) = &split_part_type($part);
push(@partids,$partid);
#
@@ -4347,7 +4269,7 @@ sub viewgrades {
return $a cmp $b;
} (keys(%$fullname))) {
$result.=&viewstudentgrade($symb,$env{'request.course.id'},
- $_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets,$is_tool);
+ $_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets);
}
$result.=&Apache::loncommon::end_data_table();
$result.='
'."\n";
@@ -4435,7 +4357,7 @@ sub viewgrades {
#--- call by previous routine to display each student who satisfies submission filter.
sub viewstudentgrade {
- my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets,$is_tool) = @_;
+ my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_;
my ($uname,$udom) = split(/:/,$student);
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my $submitonly = $env{'form.submitonly'};
@@ -4493,6 +4415,7 @@ sub viewstudentgrade {
my ($aggtries,$totaltries);
unless (exists($aggregates{$part})) {
$totaltries = $record{'resource.'.$part.'.tries'};
+
$aggtries = $totaltries;
if ($$last_resets{$part}) {
$aggtries = &get_num_tries(\%record,$$last_resets{$part},
@@ -4541,10 +4464,6 @@ sub viewstudentgrade {
# record does not get update if unchanged
sub editgrades {
my ($request,$symb) = @_;
- my $toolsymb;
- if ($symb =~ /ext\.tool$/) {
- $toolsymb = $symb;
- }
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));
my $title='
'.&mt('Current Grade Status').'
';
@@ -4591,7 +4510,7 @@ sub editgrades {
my ($part,$type) = &split_part_type($stores);
if ($part !~ m/^\Q$partid\E/) { next;}
if ($type eq 'awarded' || $type eq 'solved') { next; }
- my $display=&Apache::lonnet::metadata($url,$stores.'.display',$toolsymb);
+ my $display=&Apache::lonnet::metadata($url,$stores.'.display');
$display =~ s/\[Part: \Q$part\E\]//;
my $narrowtext = &mt('Tries');
$display =~ s/Number of Attempts/$narrowtext/;
@@ -4923,10 +4842,6 @@ ENDPICK
sub csvupload_fields {
my ($symb,$errorref) = @_;
- my $toolsymb;
- if ($symb =~ /ext\.tool$/) {
- $toolsymb = $symb;
- }
my (@parts) = &getpartlist($symb,$errorref);
if (ref($errorref)) {
if ($$errorref) {
@@ -4940,7 +4855,7 @@ sub csvupload_fields {
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
foreach my $part (sort(@parts)) {
my @datum;
- my $display=&Apache::lonnet::metadata($url,$part.'.display',$toolsymb);
+ my $display=&Apache::lonnet::metadata($url,$part.'.display');
my $name=$part;
if (!$display) { $display = $name; }
@datum=($name,$display);
@@ -5210,13 +5125,13 @@ sub csvuploadassign {
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'},
$domain,$username);
+ $countdone++;
} else {
$request->print("
".
&mt("Failed to save data for student [_1]. Message when trying to save was: [_2]",
"$username:$domain",$result)."
");
}
$request->rflush();
- $countdone++;
}
}
$request->print('
'.&Apache::lonhtmlcommon::confirm_success(&mt("Saved scores for [quant,_1,student]",$countdone),$countdone==0));
@@ -5406,7 +5321,7 @@ sub getSymbMap {
my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); },
1,0,1);
for my $sequence ($navmap->getById('0.0'), @sequences) {
- if ($navmap->hasResource($sequence, sub { shift->is_gradable(); }, 0) ) {
+ if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
my $title = $minder.'.'.
&HTML::Entities::encode($sequence->compTitle(),'"\'&');
push(@titles, $title); # minder in case two titles are identical
@@ -5503,11 +5418,10 @@ sub displayPage {
if($curRes == $iterator->BEGIN_MAP) { $depth++; }
if($curRes == $iterator->END_MAP) { $depth--; }
- if (ref($curRes) && $curRes->is_gradable()) {
+ if (ref($curRes) && $curRes->is_problem()) {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
- my $is_tool = ($symbx =~ /ext\.tool$/);
$studentTable.=
&Apache::loncommon::start_data_table_row().
'
'.$prob.
@@ -5518,34 +5432,26 @@ sub displayPage {
' | ';
$studentTable.='
';
my %form = ('CODE' => $env{'form.CODE'},);
- if ($is_tool) {
- $studentTable.=' '.$title.' ';
- } else {
- if ($env{'form.vProb'} eq 'yes' ) {
- $studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
- undef,'both',\%form);
- } else {
- my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form);
- $companswer =~ s|||g;
-# while ($companswer =~ /()/s) { #\n");
-# }
-# $companswer =~ s|||g;
- $studentTable.=' '.$title.' '.&mt('Correct answer').': '.$companswer;
- }
+ if ($env{'form.vProb'} eq 'yes' ) {
+ $studentTable.=&show_problem($request,$symbx,$uname,$udom,1,
+ undef,'both',\%form);
+ } else {
+ my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$env{'request.course.id'},%form);
+ $companswer =~ s|||g;
+# while ($companswer =~ /()/s) { #\n");
+# }
+# $companswer =~ s|||g;
+ $studentTable.=' '.$title.' '.&mt('Correct answer').': '.$companswer;
}
my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'},$udom,$uname);
if ($env{'form.lastSub'} eq 'datesub') {
if ($record{'version'} eq '') {
- my $msg = &mt('No recorded submission for this problem.');
- if ($is_tool) {
- $msg = &mt('No recorded transactions for this external tool');
- }
- $studentTable.=' '.$msg.' ';
+ $studentTable.=' '.&mt('No recorded submission for this problem.').' ';
} else {
my %responseType = ();
foreach my $partid (@{$parts}) {
@@ -5603,14 +5509,13 @@ sub displaySubByDates {
my ($symb,$record,$parts,$responseType,$checkIcon,$uname,$udom) = @_;
my $isCODE=0;
my $isTask = ($symb =~/\.task$/);
- my $is_tool = ($symb =~/\.tool$/);
if (exists($record->{'resource.CODE'})) { $isCODE=1; }
my $studentTable=&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
''.&mt('Date/Time').' | '.
($isCODE?''.&mt('CODE').' | ':'').
($isTask?''.&mt('Version').' | ':'').
- ''.($is_tool?&mt('Grade'):&mt('Submission')).' | '.
+ ''.&mt('Submission').' | '.
''.&mt('Status').' | '.
&Apache::loncommon::end_data_table_header_row();
my ($version);
@@ -5618,11 +5523,7 @@ sub displaySubByDates {
my %orders;
$mark{'correct_by_student'} = $checkIcon;
if (!exists($$record{'1:timestamp'})) {
- if ($is_tool) {
- return ' '.&mt('No grade passed back.').' ';
- } else {
- return ' '.&mt('Nothing submitted - no attempts.').' ';
- }
+ return ' '.&mt('Nothing submitted - no attempts.').' ';
}
my $interaction;
@@ -5658,8 +5559,6 @@ sub displaySubByDates {
my @matchKey;
if ($isTask) {
@matchKey = sort(grep(/^resource\.\d+\.\Q$partid\E\.award$/,@versionKeys));
- } elsif ($is_tool) {
- @matchKey = sort(grep(/^resource\.\Q$partid\E\.awarded$/,@versionKeys));
} else {
@matchKey = sort(grep(/^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys));
}
@@ -5668,51 +5567,48 @@ sub displaySubByDates {
foreach my $matchKey (@matchKey) {
if (exists($$record{$version.':'.$matchKey}) &&
$$record{$version.':'.$matchKey} ne '') {
- if ($is_tool) {
- $displaySub[0].=$$record{"$version:resource.$partid.awarded"};
+
+ my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
+ : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
+ $displaySub[0].='';
+ $displaySub[0].=''.&mt('Part: [_1]',$display_part).''
+ .' '
+ .'('.&mt('Response ID: [_1]',$responseId).')'
+ .''
+ .' ';
+ if ($hidden) {
+ $displaySub[0].= &mt('Anonymous Survey').'';
} else {
- my ($responseId)= ($isTask ? ($matchKey=~ /^resource\.(.*?)\.\Q$partid\E\.award$/)
- : ($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/));
- $displaySub[0].='';
- $displaySub[0].=''.&mt('Part: [_1]',$display_part).''
- .' '
- .'('.&mt('Response ID: [_1]',$responseId).')'
- .''
- .' ';
- if ($hidden) {
- $displaySub[0].= &mt('Anonymous Survey').'';
- } 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').')';
- }
- }
- $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].=''.$newvariation.''; # /nobreak
- $displaySub[0].=' '.
- &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).' ';
+ 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').')';
+ }
+ }
+ $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].=''.$newvariation.''; # /nobreak
+ $displaySub[0].=' '.
+ &cleanRecord($$record{$version.':'.$matchKey},$responseType,$symb,$partid,$responseId,$record,$orders{$partid}->{$responseId},"$version:",$uname,$udom,$type,$trial,$rndseed).' ';
}
}
}
@@ -5727,22 +5623,14 @@ sub displaySubByDates {
lc($$record{"$where.$partid.award"}).' '.
$mark{$$record{"$where.$partid.solved"}}.
' ';
- } 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"};
- unless ($is_tool) {
- $displaySub[2].=' ('.&mt('Part').': '.$display_part.')';
- }
+ $displaySub[2].=$$record{"$where.$partid.regrader"}.
+ ' ('.&mt('Part').': '.$display_part.')';
} elsif ($$record{"$version:resource.$partid.regrader"} =~ /\S/) {
$displaySub[2].=
- $$record{"$version:resource.$partid.regrader"};
- unless ($is_tool) {
- $displaySub[2].=' ('.&mt('Part').': '.$display_part.')';
- }
+ $$record{"$version:resource.$partid.regrader"}.
+ ' ('.&mt('Part').': '.$display_part.')';
}
}
# needed because old essay regrader has not parts info
@@ -10301,13 +10189,12 @@ sub submit_options_table {
my ($request,$symb) = @_;
if (!$symb) {return '';}
&commonJSfunctions($request);
- my $is_tool = ($symb =~ /ext\.tool$/);
my $result;
$result.='');
}
-#----- display problem, answer, and submissions for a single student (no grading)
-
-sub view_as_user {
- my ($symb,$vuname,$vudom,$hasperm) = @_;
- my $plainname = &Apache::loncommon::plainname($vuname,$vudom,'lastname');
- my $displayname = &nameUserString('',$plainname,$vuname,$vudom);
- my $output = &Apache::loncommon::get_student_view($symb,$vuname,$vudom,
- $env{'request.course.id'},
- undef,{'disable_submit' => 1}).
- "\n\n".
- ''.
- ' '.$displayname.''.
- "\n".
- &Apache::loncommon::track_student_link('View recent activity',
- $vuname,$vudom,'check').' '.
- "\n";
- if (&Apache::lonnet::allowed('opa',$env{'request.course.id'}) ||
- (($env{'request.course.sec'} ne '') &&
- &Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'.$env{'request.course.sec'}))) {
- $output .= &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),
- $vuname,$vudom,$symb,'check');
- }
- $output .= "\n";
- my $companswer = &Apache::loncommon::get_student_answers($symb,$vuname,$vudom,
- $env{'request.course.id'});
- $companswer=~s| ||g;
- $companswer=~s|name="submit"|name="would_have_been_submit"|g;
- $output .= ' '.
- ' '.&mt('Correct answer for[_1]',$displayname).''.
- $companswer.
- ''."\n";
- my $is_tool = ($symb =~ /ext\.tool$/);
- my ($essayurl,%coursedesc_by_cid);
- (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb);
- my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$vudom,$vuname);
- my $res_error;
- my ($partlist,$handgrade,$responseType,$numresp,$numessay) =
- &response_type($symb,\$res_error);
- my $fullname;
- my $collabinfo;
- if ($numessay) {
- unless ($hasperm) {
- &init_perm();
- }
- ($collabinfo,$fullname)=
- &check_collaborators($symb,$vuname,$vudom,\%record,$handgrade,0);
- unless ($hasperm) {
- &reset_perm();
- }
- }
- my $checkIcon = ' ';
- my ($lastsubonly,$partinfo) =
- &show_last_submission($vuname,$vudom,$symb,$essayurl,$responseType,'datesub',
- '',$fullname,\%record,\%coursedesc_by_cid);
- $output .= ' '.
- ' '.&mt('Submissions').''."\n".$collabinfo."\n";
- if (($numresp > $numessay) & !$is_tool) {
- $output .=' '.
- &mt('Part(s) graded correct by the computer is marked with a [_1] symbol.',$checkIcon).
- " \n";
- }
- $output .= $partinfo;
- $output .= $lastsubonly;
- $output .= &displaySubByDates($symb,\%record,$partlist,$responseType,$checkIcon,$vuname,$vudom);
- $output .= ' '."\n";
- return $output;
-}
-
sub handler {
my $request=$_[0];
&reset_caches();
|