[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 04 Nov 2003 19:38:09 -0000
albertel Tue Nov 4 14:38:09 2003 EDT
Modified files:
/loncom/homework grades.pm
Log:
- grading now respects hidden parts (BUG#55) only SPRS is left
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.145 loncom/homework/grades.pm:1.146
--- loncom/homework/grades.pm:1.145 Tue Oct 28 18:20:03 2003
+++ loncom/homework/grades.pm Tue Nov 4 14:38:09 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.145 2003/10/28 23:20:03 albertel Exp $
+# $Id: grades.pm,v 1.146 2003/11/04 19:38:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -55,17 +55,35 @@
# ----- These first few routines are general use routines.----
#
-# --- Retrieve the parts that matches stores_\d+ from the metadata file.---
+# --- Retrieve the parts from the metadata file.---
sub getpartlist {
- my ($url) = @_;
- my @parts =();
- my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys'));
- foreach my $key (@metakeys) {
- if ( $key =~ m/stores_(\w+)_.*/) {
- push(@parts,$key);
+ my ($url,$symb) = @_;
+ my $partorder = &Apache::lonnet::metadata($url, 'partorder');
+ my @parts;
+ if ($partorder) {
+ for my $part (split (/,/,$partorder)) {
+ if (!&Apache::loncommon::check_if_partid_hidden($part,$symb)) {
+ push(@parts, $part);
+ }
+ }
+ } else {
+ my $metadata = &Apache::lonnet::metadata($url, 'packages');
+ foreach (split(/\,/,$metadata)) {
+ if ($_ =~ /^part_(.*)$/) {
+ if (!&Apache::loncommon::check_if_partid_hidden($1,$symb)) {
+ push(@parts, $1);
+ }
+ }
}
}
- return @parts;
+ my @stores;
+ foreach my $part (@parts) {
+ my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys'));
+ foreach my $key (@metakeys) {
+ if ($key =~ m/^stores_\Q$part\E_/) { push(@stores,$key); }
+ }
+ }
+ return @stores;
}
# --- Get the symbolic name of a problem and the url
@@ -120,6 +138,9 @@
if (/^\w+response_\w+.*/) {
my ($responsetype,$part) = split(/_/,$_,2);
my ($partid,$respid) = split(/_/,$part);
+ if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) {
+ next;
+ }
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!!
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb);
$handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no');
@@ -2193,7 +2214,7 @@
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n".
'<table border=0><tr bgcolor="#deffff"><td> <b>No.</b> </td>'.
'<td>'.&nameUserString('header')."</td>\n";
- my (@parts) = sort(&getpartlist($url));
+ my (@parts) = sort(&getpartlist($url,$symb));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
$display =~ s|^Number of Attempts|Tries<br />|; # makes the column narrower
@@ -2310,7 +2331,7 @@
my %columns = ();
my ($i,$ctr,$count,$rec_update) = (0,0,0,0);
- my (@parts) = sort(&getpartlist($url));
+ my (@parts) = sort(&getpartlist($url,$symb));
my $header;
while ($ctr < $ENV{'form.totalparts'}) {
my $partid = $ENV{'form.partid_'.$ctr};
@@ -2575,8 +2596,8 @@
}
sub csvupload_fields {
- my ($url) = @_;
- my (@parts) = &getpartlist($url);
+ my ($url,$symb) = @_;
+ my (@parts) = &getpartlist($url,$symb);
my @fields=(['username','Student Username'],['domain','Student Domain']);
foreach my $part (sort(@parts)) {
my @datum;
@@ -2659,7 +2680,7 @@
&csvuploadmap_header($request,$symb,$url,$datatoken,$#records+1);
my ($i,$keyfields);
if (@records) {
- my @fields=&csvupload_fields($url);
+ my @fields=&csvupload_fields($url,$symb);
if ($ENV{'form.upfile_associate'} eq 'reverse') {
&Apache::loncommon::csv_print_samples($request,\@records);