version 1.560, 2018/05/15 04:59:14
|
version 1.562, 2018/12/26 19:40:04
|
Line 1117 sub finalize_storage {
|
Line 1117 sub finalize_storage {
|
delete(@Apache::lonhomework::results{@remove}); |
delete(@Apache::lonhomework::results{@remove}); |
my ($symb,$courseid,$domain,$name) = |
my ($symb,$courseid,$domain,$name) = |
&Apache::lonnet::whichuser($given_symb); |
&Apache::lonnet::whichuser($given_symb); |
my ($passback,$ltiscope,$ltimap,$ltisymb,$ltiref,$total,$possible); |
my ($passback,$ltiscope,$ltimap,$ltisymb,$ltiref,$total,$possible,$dopassback); |
if ($env{'request.state'} eq 'construct' |
if ($env{'request.state'} eq 'construct' |
|| $symb eq '' |
|| $symb eq '' |
|| $Apache::lonhomework::type eq 'practice') { |
|| $Apache::lonhomework::type eq 'practice') { |
Line 1219 sub finalize_storage {
|
Line 1219 sub finalize_storage {
|
} |
} |
} |
} |
} |
} |
if (($passback) && ($ltiscope eq 'resource') && ($ltisymb eq $symb)) { |
if ($passback) { |
|
foreach my $key (keys(%Apache::lonhomework::results)) { |
|
if ($key =~ /^resource\.([^\.]+)\.solved$/) { |
|
my $part = $1; |
|
if ((($Apache::lonhomework::results{$key} =~ /^correct_/) || |
|
($Apache::lonhomework::results{$key} eq 'incorrect_attempted')) && |
|
($Apache::lonhomework::results{"resource.$part.tries"})) { |
|
$dopassback = 1; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
if (($dopassback) && ($ltiscope eq 'resource') && ($ltisymb eq $symb)) { |
$total = 0; |
$total = 0; |
$possible = 0; |
$possible = 0; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
Line 1258 sub finalize_storage {
|
Line 1271 sub finalize_storage {
|
} |
} |
&Apache::lonxml::debug('Store return message:'.$result); |
&Apache::lonxml::debug('Store return message:'.$result); |
&store_aggregates($symb,$courseid); |
&store_aggregates($symb,$courseid); |
if ($passback) { |
if ($dopassback) { |
my $scoreformat = 'decimal'; |
my $scoreformat = 'decimal'; |
if (ref($ltiref) eq 'HASH') { |
if (ref($ltiref) eq 'HASH') { |
if ($ltiref->{'scoreformat'} =~ /^(decimal|ratio|percentage)$/) { |
if ($ltiref->{'scoreformat'} =~ /^(decimal|ratio|percentage)$/) { |
Line 1765 sub start_problem {
|
Line 1778 sub start_problem {
|
my $ipused; |
my $ipused; |
|
|
my $name= &get_resource_name($parstack,$safeeval); |
my $name= &get_resource_name($parstack,$safeeval); |
my ($result,$form_tag_start,$slot_name,$slot,$probpartlist); |
my ($result,$form_tag_start,$slot_name,$slot,$probpartlist,$firstaccres); |
|
|
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
if ($env{'form.markaccess'}) { |
if ($env{'form.markaccess'}) { |
my @interval=&Apache::lonnet::EXT("resource.0.interval"); |
my @interval=&Apache::lonnet::EXT("resource.0.interval"); |
my ($timelimit) = split(/_/,$interval[0]); |
my ($timelimit) = split(/_/,$interval[0]); |
&Apache::lonnet::set_first_access($interval[1],$timelimit); |
my $is_set = &Apache::lonnet::set_first_access($interval[1],$timelimit); |
|
unless (($is_set eq 'ok') || ($is_set eq 'already_set')) { |
|
$firstaccres = $is_set; |
|
} |
} |
} |
} |
} |
|
|
Line 1879 sub start_problem {
|
Line 1895 sub start_problem {
|
( $status eq 'NEED_DIFFERENT_IP')) { |
( $status eq 'NEED_DIFFERENT_IP')) { |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
$style); |
$style); |
|
if (($status eq 'NOT_YET_VIEWED') && ($firstaccres)) { |
|
$result .= '<p class="LC_error">'. |
|
&mt('A problem occurred when trying to start the timer.').'</p>'; |
|
} |
$result .= &access_status_msg('problem',$status,$symb,$target,$ipused,$accessmsg); |
$result .= &access_status_msg('problem',$status,$symb,$target,$ipused,$accessmsg); |
} elsif ($status eq 'NEEDS_CHECKIN') { |
} elsif ($status eq 'NEEDS_CHECKIN') { |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |
my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, |