--- loncom/homework/lonhomework.pm 2016/05/13 22:48:09 1.361 +++ 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.361 2016/05/13 22:48:09 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 {