--- loncom/homework/lonhomework.pm 2016/03/15 14:25:33 1.360 +++ loncom/homework/lonhomework.pm 2016/05/30 02:45:32 1.362 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.360 2016/03/15 14:25:33 raeburn Exp $ +# $Id: lonhomework.pm,v 1.362 2016/05/30 02:45:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -561,15 +561,16 @@ sub check_access { if ($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER') { my @interval=&Apache::lonnet::EXT("resource.$id.interval",$symb); &Apache::lonxml::debug("looking for interval @interval"); - if ($interval[0]) { + if ($interval[0]=~ /^\d+/) { my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb); &Apache::lonxml::debug("looking for accesstime $first_access"); if (!$first_access) { $status='NOT_YET_VIEWED'; my $due_date = &due_date($id,$symb); my $seconds_left = $due_date - time; - if ($seconds_left > $interval[0] || $due_date eq '') { - $seconds_left = $interval[0]; + my ($timelimit) = ($interval[0] =~ /^(\d+)/); + if ($seconds_left > $timelimit || $due_date eq '') { + $seconds_left = $timelimit; } $datemsg=&seconds_to_human_length($seconds_left); } @@ -604,7 +605,8 @@ sub due_date { my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb); &Apache::lonxml::debug("looking for first_access $first_access ($interval[1])"); if (defined($first_access)) { - my $interval = $first_access+$interval[0]; + my ($timelimit) = ($interval[0] =~ /^(\d+)/); + my $interval = $first_access+$timelimit; $date = (!$due_date || $interval < $due_date) ? $interval : $due_date; } else { @@ -1440,8 +1442,9 @@ sub zero_timer { my $now = time; my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb); if ($first_access > 0) { - my ($timelimit,$done,$proctor,$secret) = split(/_/,$interval[0]); - if ($done eq 'done') { + my ($timelimit,$donesuffix) = split(/_/,$interval[0],2); + if ($donesuffix =~ /^done(?:|\:[^\:]+\:)(.*)$/) { + my ($dummy,$proctor,$secret) = split(/_/,$1); if (($proctor) && ($secret ne '')) { my $key = $env{'form.LC_interval_done_proctorpass'}; $key =~ s/^\s+//;