--- loncom/homework/grades.pm 2002/07/10 21:08:38 1.38 +++ loncom/homework/grades.pm 2002/07/18 21:27:57 1.39 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.38 2002/07/10 21:08:38 ng Exp $ +# $Id: grades.pm,v 1.39 2002/07/18 21:27:57 ng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,7 +42,7 @@ use Apache::loncommon; use Apache::lonhomework; use Apache::lonmsg qw(:user_normal_msg); use Apache::Constants qw(:common); -use Time::HiRes qw( gettimeofday tv_interval ); +#use Time::HiRes qw( gettimeofday tv_interval ); sub moreinfo { my ($request,$reason) = @_; @@ -96,26 +96,23 @@ sub verifyreceipt { } sub student_gradeStatus { - my ($url,$udom,$uname) = @_; - my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); - my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); - foreach my $part (&getpartlist($url)) { - my ($temp,$part,$type)=split(/_/,$part); - if ($type eq 'solved') { - my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); - $status = 'partial' if ($foo =~ /^partially/); + my ($url,$udom,$uname,$partlist) = @_; + my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); + my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); + my %partstatus = (); + foreach (@$partlist) { + my ($status,$foo)=split(/_/,$record{"resource.$_.solved"},2); $status = 'nothing' if ($status eq ''); - return $type,$status; - } - } - return ''; + $partstatus{$_} = $status; + } + return %partstatus; } sub get_fullname { - my ($sname,$sdom) = @_; + my ($uname,$udom) = @_; my %name=&Apache::lonnet::get('environment', ['lastname','generation', 'firstname','middlename'], - $sdom,$sname); + $udom,$uname); my $fullname; my ($tmp) = keys(%name); if ($tmp !~ /^(con_lost|error|no_such_host)/i) { @@ -126,6 +123,25 @@ sub get_fullname { return $fullname; } +sub response_type { + my ($url) = shift; + my $allkeys = &Apache::lonnet::metadata($url,'keys'); + my %seen = (); + my (@partlist,%handgrade); + foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) { + if (/^\w+response_\d{1,2}.*/) { + my ($responsetype,$part) = split(/_/,$_,2); + my ($partid,$respid) = split(/_/,$part); + $handgrade{$part} = $responsetype.':'.($allkeys =~ /parameter_$part\_handgrade/ ? 'yes' : 'no'); + next if ($seen{$partid} > 0); + $seen{$partid}++; + push @partlist,$partid; + } + } + return \@partlist,\%handgrade; +} + + sub listStudents { my ($request) = shift; my $cdom =$ENV{"course.$ENV{'request.course.id'}.domain"}; @@ -133,25 +149,32 @@ sub listStudents { my $getsec =$ENV{'form.section'}; my $submitonly=$ENV{'form.submitonly'}; + my $result='
Resource: '.$ENV{'form.url'}.' | ||
Part id: '.$_.' | '. + 'Type: '.$responsetype.' | '. + 'Handgrade: '.$handgrade.' |