[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Sun Apr 1 12:19:20 EDT 2012


raeburn		Sun Apr  1 16:19:20 2012 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Bug 6518.
    - Blocking based on timed interval expires when items in the folder or
      resource to which the interval applies are no longer answerable (e.g.,
      all problems correct, or no tries left).   
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1162 loncom/lonnet/perl/lonnet.pm:1.1163
--- loncom/lonnet/perl/lonnet.pm:1.1162	Sat Mar 31 23:10:55 2012
+++ loncom/lonnet/perl/lonnet.pm	Sun Apr  1 16:19:20 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1162 2012/03/31 23:10:55 raeburn Exp $
+# $Id: lonnet.pm,v 1.1163 2012/04/01 16:19:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6365,6 +6365,7 @@
                   );
     my @blockers;
     my $now = time;
+    my $navmap = Apache::lonnavmaps::navmap->new();
     foreach my $block (keys(%commblocks)) {
         if ($block =~ /^(\d+)____(\d+)$/) {
             my ($start,$end) = ($1,$2);
@@ -6390,6 +6391,7 @@
             }
         } elsif ($block =~ /^firstaccess____(.+)$/) {
             my $item = $1;
+            my @to_test;
             if (ref($commblocks{$block}{'blocks'}) eq 'HASH') {
                 if (ref($commblocks{$block}{'blocks'}{'docs'}) eq 'HASH') {
                     my $check_interval;
@@ -6403,14 +6405,17 @@
                             if ($item =~ /___\d+___/) {
                                 $type = 'resource';
                                 @interval=&EXT("resource.0.interval",$item);
+                                if (ref($navmap)) {                        
+                                    my $res = $navmap->getBySymb($item); 
+                                    push(@to_test,$res);
+                                }
                             } else {
                                 my $mapsymb = &symbread($item,1);
                                 if ($mapsymb) {
-                                    my $navmap = Apache::lonnavmaps::navmap->new();
                                     if (ref($navmap)) {
                                         my $mapres = $navmap->getBySymb($mapsymb);
-                                        my @resources = $mapres->retrieveResources($mapres,undef,0,1);
-                                        foreach my $res (@resources) {
+                                        @to_test = $mapres->retrieveResources($mapres,undef,0,1);
+                                        foreach my $res (@to_test) {
                                             my $symb = $res->symb();
                                             next if ($symb eq $mapsymb);
                                             if ($symb ne '') {
@@ -6434,8 +6439,15 @@
                             if ($first_access) {
                                 my $timesup = $first_access+$interval[0];
                                 if ($timesup > $now) {
-                                    unless (grep(/^\Q$block\E$/, at blockers)) {
-                                        push(@blockers,$block);
+                                    foreach my $res (@to_test) {
+                                        if ($res->is_problem()) {
+                                            if ($res->completable()) {
+                                                unless (grep(/^\Q$block\E$/, at blockers)) {
+                                                    push(@blockers,$block);
+                                                }
+                                                last;
+                                            }
+                                        }
                                     }
                                 }
                             }




More information about the LON-CAPA-cvs mailing list