version 1.116, 2005/03/28 23:19:45
|
version 1.118, 2005/04/04 10:04:09
|
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 512 sub answer_footer {
|
Line 513 sub answer_footer {
|
sub showallfoils { |
sub showallfoils { |
if (defined($ENV{'form.showallfoils'})) { |
if (defined($ENV{'form.showallfoils'})) { |
my ($symb)=&Apache::lonxml::whichuser(); |
my ($symb)=&Apache::lonxml::whichuser(); |
if ($ENV{'request.state'} eq 'construct' || |
if (($ENV{'request.state'} eq 'construct') || |
$ENV{'user.adv'} ) { |
($ENV{'user.adv'} && $symb eq '') || |
|
($Apache::lonhomework::viewgrades) ) { |
return 1; |
return 1; |
} |
} |
} |
} |
Line 726 sub submitted {
|
Line 728 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__ |
|
|