[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet assesscalc.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sun, 15 May 2005 02:18:12 -0000
albertel Sat May 14 22:18:12 2005 EDT
Modified files:
/loncom/interface/spreadsheet assesscalc.pm
Log:
- checking if a partid is hidden can be 'expensive' only chek if we have a parmaeter sitting there
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.40 loncom/interface/spreadsheet/assesscalc.pm:1.41
--- loncom/interface/spreadsheet/assesscalc.pm:1.40 Fri May 13 17:14:46 2005
+++ loncom/interface/spreadsheet/assesscalc.pm Sat May 14 22:18:12 2005
@@ -1,5 +1,5 @@
#
-# $Id: assesscalc.pm,v 1.40 2005/05/13 21:14:46 albertel Exp $
+# $Id: assesscalc.pm,v 1.41 2005/05/15 02:18:12 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -661,6 +661,7 @@
sub determine_parts {
my $self = shift;
+ my $check_hidden = shift;
if (exists($self->{'Parts'}) && ref($self->{'Parts'}) eq 'HASH') {
return;
}
@@ -671,9 +672,10 @@
my $metadata = &Apache::lonnet::metadata($src,'packages');
foreach (split(',',$metadata)) {
my ($part) = (/^part_(.*)$/);
- if (defined($part) &&
- ! &Apache::loncommon::check_if_partid_hidden
- ($part,$self->{'symb'},$self->{'name'},$self->{'domain'})
+ if (!defined($part)) { next; }
+ if (!$check_hidden) { $Parts{$part}++; next; }
+ if (!&Apache::loncommon::check_if_partid_hidden
+ ($part,$self->{'symb'},$self->{'name'},$self->{'domain'})
) {
$Parts{$part}++;
}
@@ -749,19 +751,14 @@
}
#
# Get the students performance data
+ $self->determine_parts(exists($parameters{'parameter_0_hiddenparts'}));
my %student_parameters = $self->get_problem_state();
while (my ($parm,$value) = each(%student_parameters)) {
$parm =~ s/^resource\./stores_/;
$parm =~ s/\./_/g;
- $parameters{$parm} = $value;
- }
- #
- # Clean out any bad parameters
- $self->determine_parts();
- foreach my $param (keys(%parameters)) {
- if (! $self->parameter_part_is_valid($param)) {
- delete ($parameters{$param});
- }
+ # Clean out any bad parameters
+ next if (! $self->parameter_part_is_valid($parm));
+ $parameters{$parm} = $value;
}
#
# Set up the formulas and parameter values