version 1.116, 2005/03/28 23:19:45
|
version 1.117, 2005/04/01 18:08:14
|
Line 110 sub poprandomnumber {
|
Line 110 sub poprandomnumber {
|
&Apache::lonxml::error("Unable to restore random algorithm."); |
&Apache::lonxml::error("Unable to restore random algorithm."); |
} |
} |
} |
} |
|
|
sub setrandomnumber { |
sub setrandomnumber { |
my $rndseed; |
my $rndseed; |
$rndseed=&Apache::structuretags::setup_rndseed(); |
$rndseed=&Apache::structuretags::setup_rndseed(); |
Line 726 sub submitted {
|
Line 727 sub submitted {
|
# otherwise no submission occured |
# otherwise no submission occured |
return 0; |
return 0; |
} |
} |
|
|
|
# basically undef and 0 (both false) mean that they still have work to do |
|
# and all true values mean that they can't do any more work |
|
# |
|
# a return of undef means it is unattempted |
|
# a return of 0 means it is attmpted and wrong but still has tries |
|
# a return of 1 means it is marked correct |
|
# a return of 2 means they have exceed maximum number of tries |
|
# a return of 3 means it after the answer date |
|
sub check_status { |
|
my ($id)=@_; |
|
if (!$id) { $id=$Apache::linputtags::part; } |
|
my $curtime=&Apache::lonnet::EXT('system.time'); |
|
my $opendate=&Apache::lonnet::EXT("resource.$id.opendate"); |
|
my $duedate=&Apache::lonnet::EXT("resource.$id.duedate"); |
|
my $answerdate=&Apache::lonnet::EXT("resource.$id.answerdate"); |
|
if ( $opendate && $curtime > $opendate && |
|
$duedate && $curtime > $duedate && |
|
$answerdate && $curtime > $answerdate) { |
|
return 3; |
|
} |
|
my $status=&Apache::lonnet::EXT("user.resource.resource.$id.solved"); |
|
if ($status =~ /^correct/) { return 1; } |
|
if (!$status) { return undef; } |
|
my $maxtries=&Apache::lonnet::EXT("resource.$id.maxtries"); |
|
if ($maxtries eq '') { $maxtries=2; } |
|
my $curtries=&Apache::lonnet::EXT("user.resource.resource.$id.tries"); |
|
if ($curtries < $maxtries) { return 0; } |
|
return 2; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|