[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm lonhomework.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 20 May 2005 18:07:33 -0000
albertel Fri May 20 14:07:33 2005 EDT
Modified files:
/loncom/homework bridgetask.pm lonhomework.pm
Log:
- full cycle of take -> grade -> fail -> take again -> grade again -> pass works
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.26 loncom/homework/bridgetask.pm:1.27
--- loncom/homework/bridgetask.pm:1.26 Thu May 19 17:28:06 2005
+++ loncom/homework/bridgetask.pm Fri May 20 14:07:29 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.26 2005/05/19 21:28:06 albertel Exp $
+# $Id: bridgetask.pm,v 1.27 2005/05/20 18:07:29 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -71,7 +71,7 @@
if ($authhost ne 'no_host') {
my $version=
$Apache::lonhomework::results{'resource.version'}=
- $Apache::lonhomework::history{'resource.version'}++;
+ ++$Apache::lonhomework::history{'resource.version'};
$Apache::lonhomework::results{"resource.$version.checkedin"}=
$user.'@'.$domain;
$Apache::lonhomework::results{"resource.$version.checkedin.slot"}=
@@ -271,8 +271,7 @@
if ($target eq 'web') {
if ($status eq 'CAN_ANSWER') {
$result.="\n".'<table border="1">'.
- &Apache::inputtags::file_selector($version,
- "bridgetask","*",
+ &Apache::inputtags::file_selector('0',"bridgetask","*",
'portfolioonly').
"</table>";
$result.=&Apache::inputtags::gradestatus('0');
@@ -388,7 +387,12 @@
}
sub remove_from_queue {
- &Apache::lonxml::debug("Want to remove. Done?");
+ my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser();
+ my $cnum=$env{'course.'.$cid.'.num'};
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my $key="$symb\0queue\0$uname\@$udom";
+ my @keys=($key,"$key\0locked");
+ &Apache::lonnet::del('gradingqueue',\@keys,$cdom,$cnum);
}
sub setup_env_for_other_user {
@@ -417,27 +421,27 @@
my $cdom=$env{'course.'.$cid.'.domain'};
my $regexp="^$symb\0";
my %queue=&Apache::lonnet::dump('gradingqueue',$cdom,$cnum,$regexp);
- $result.="\n<h3>Current Queue</h3><table><tr><th>resource</th>".
+ $result.="\n<h3>Current Queue</h3><table border='1'><tr><th>resource</th>".
"<th>user</th><th>type</th><th>data</th></tr>";
foreach my $key (sort(keys(%queue))) {
if ($key=~/locked$/) {
my ($symb,$uname,$udom) = &decode_queue_key($key);
my $title=&Apache::lonnet::gettitle($symb);
- $result.="<tr><td>$title</td><td>$uname</td><td>";
+ $result.="<tr><td>$title</td><td>$uname</td>";
$result.='<td>lock</td><td>'.$queue{$key}.'</td></tr>';
} elsif ($key=~/timestamp$/) {
my ($symb,undef) = split("\0",$key);
my $title=&Apache::lonnet::gettitle($symb);
- $result.="<tr><td>$title</td><td></td><td>";
+ $result.="<tr><td>$title</td><td></td>";
$result.='<td>last queue modification time</td><td>'.
&Apache::lonlocal::locallocaltime($queue{$key})."</td></tr>";
} else {
my ($symb,$uname,$udom) = &decode_queue_key($key);
my $title=&Apache::lonnet::gettitle($symb);
- $result.="<tr><td>$title</td><td>$uname</td><td>";
+ $result.="<tr><td>$title</td><td>$uname</td>";
my $slot=$queue{$key}->[0];
my %slot_data=&Apache::lonnet::get_slot($slot);
- $result.='<td>queue entry</td><td>End time: '.
+ $result.='<td>queue entry</td><td>Slot: '.$slot.' End time: '.
&Apache::lonlocal::locallocaltime($slot_data{'endtime'}).
"</td></tr>";
}
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.208 loncom/homework/lonhomework.pm:1.209
--- loncom/homework/lonhomework.pm:1.208 Tue May 10 16:58:38 2005
+++ loncom/homework/lonhomework.pm Fri May 20 14:07:29 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.208 2005/05/10 20:58:38 albertel Exp $
+# $Id: lonhomework.pm,v 1.209 2005/05/20 18:07:29 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -242,11 +242,9 @@
return ($status,$datemsg);
}
my $version=$Apache::lonhomework::history{'resource.version'};
- if ($Apache::lonhomework::history{"resource.$version.checkedin"}) {
- if ($Apache::lonhomework::history{"resource.$version.status"} eq 'pass' ||
- $Apache::lonhomework::history{"resource.$version.status"} eq 'fail') {
- return ('SHOW_ANSWER');
- }
+ if ($Apache::lonhomework::history{"resource.$version.checkedin"} &&
+ $Apache::lonhomework::history{"resource.$version.status"} eq 'pass') {
+ return ('SHOW_ANSWER');
}
my ($id)=@_;
my @slots=split(':',&Apache::lonnet::EXT("resource.$id.available"));
@@ -274,9 +272,13 @@
&Apache::lonxml::debug("protoctor checked in");
$slotstatus='CAN_ANSWER';
}
- if ( ($slotstatus eq 'NOT_IN_A_SLOT' || $slotstatus eq 'NEEDS_CHECKIN') &&
+ if ( $slotstatus eq 'NOT_IN_A_SLOT' &&
$Apache::lonhomework::history{"resource.$version.checkedin"}) {
- return ('WAITING_FOR_GRADE');
+ if ($Apache::lonhomework::history{"resource.$version.status"} eq 'fail') {
+ return ('SHOW_ANSWER');
+ } else {
+ return ('WAITING_FOR_GRADE');
+ }
}
return ($slotstatus,$datemsg,$slot_name,$returned_slot);
}