[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet assesscalc.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 12 Oct 2005 21:29:49 -0000


albertel		Wed Oct 12 17:29:49 2005 EDT

  Modified files:              
    /loncom/interface/spreadsheet	assesscalc.pm 
  Log:
  - BUG#4410 was not doing an exhaustive search for possible part info
  
  
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.50 loncom/interface/spreadsheet/assesscalc.pm:1.51
--- loncom/interface/spreadsheet/assesscalc.pm:1.50	Tue May 17 16:14:19 2005
+++ loncom/interface/spreadsheet/assesscalc.pm	Wed Oct 12 17:29:49 2005
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.50 2005/05/17 20:14:19 albertel Exp $
+# $Id: assesscalc.pm,v 1.51 2005/10/12 21:29:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -703,15 +703,17 @@
         return 1;
     }
     #
-    my (undef,$part) = 
-        ($parameter =~ m/^(resource|stores|parameter)_([^_]+)_.*/);
-    if (exists($self->{'Parts'})          && 
-        exists($self->{'Parts'}->{$part}) &&
-        $self->{'Parts'}->{$part} ) {
-        return 1;
-    } else {
-        return 0;
+    my ($start,@pieces)=split('_',$parameter);
+    if ( $start !~ m/^(resource|stores|parameter)$/) { return 0; }
+    while (@pieces) {
+        pop(@pieces);
+        my $testpart=join('_',@pieces);
+	if (exists($self->{'Parts'}->{$testpart}) &&
+	    $self->{'Parts'}->{$testpart} ) {
+	    return 1;
+	}
     }
+    return 0;
 }
 
 sub compute {