[LON-CAPA-cvs] cvs: loncom /html/adm/helper resettimes.helper

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


raeburn		Sun Apr  1 16:12:43 2012 EDT

  Modified files:              
    /loncom/html/adm/helper	resettimes.helper 
  Log:
  - Bug 6518.
    - Also remove entry for student from timerinterval.db when resetting
      student access times for map/resource with timer parameter. 
  
  
Index: loncom/html/adm/helper/resettimes.helper
diff -u loncom/html/adm/helper/resettimes.helper:1.8 loncom/html/adm/helper/resettimes.helper:1.9
--- loncom/html/adm/helper/resettimes.helper:1.8	Mon Feb 16 15:47:21 2009
+++ loncom/html/adm/helper/resettimes.helper	Sun Apr  1 16:12:42 2012
@@ -72,13 +72,17 @@
         &Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
         foreach my $escsymb (split(/\|\|\|/,$helper->{'VARS'}{'delete'})) {
 	    my $symb=&Apache::lonnet::unescape($escsymb);
+            my $key = "$courseid\0$symb";
+            my $title =    
+                ($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
+                                    : $env{'course.'.$courseid.'.description'};
 	    my $res=&Apache::lonnet::del('firstaccesstimes',
-					 ["$courseid\0$symb"],$udom,$uname);
-	    my $title = 
-		($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
-	                            : $env{'course.'.$env{'request.course.id'}.'.description'};
-	    $result.="Removing access time from ".
-		      $title.": ".$res.'</li><li>';
+					 [$key],$udom,$uname);
+            $result.="Removing access time from ".
+                      $title.": ".$res.'</li><li>';
+            if ($res eq 'ok') {
+                &Apache::lonnet::del('timerinterval',[$key],$udom,$uname);
+            }
 	}
         $result=~s/<li>$//;
         return $result;
@@ -140,8 +144,13 @@
 		$result.="Removing access times ".
 		    &Apache::lonlocal::locallocaltime($times{$key}).
 		    " found for student ".$fullname.": ";
-		$result.=&Apache::lonnet::del('firstaccesstimes',
+		my $delres=&Apache::lonnet::del('firstaccesstimes',
 					      [$key],$udom,$uname);
+                $result.=$delres;
+                if ($delres eq 'ok') {
+                    &Apache::lonnet::del('timerinterval',
+                                         [$key],$udom,$uname);
+                }
 	    }
 	    $result.="</li>\n<li>";
 	}




More information about the LON-CAPA-cvs mailing list