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

raeburn raeburn at source.lon-capa.org
Tue May 31 18:04:15 EDT 2016


raeburn		Tue May 31 22:04:15 2016 EDT

  Modified files:              
    /loncom/html/adm/helper	resettimes.helper 
  Log:
  - Bug 6763. "Done" button.
    - When "Reset access times" helper deletes student-specific interval 
      interval parameter (set by "Done" button push), devalidate cache of 
      userres data for that student.
  
  
Index: loncom/html/adm/helper/resettimes.helper
diff -u loncom/html/adm/helper/resettimes.helper:1.10 loncom/html/adm/helper/resettimes.helper:1.11
--- loncom/html/adm/helper/resettimes.helper:1.10	Thu Mar 17 15:10:10 2016
+++ loncom/html/adm/helper/resettimes.helper	Tue May 31 22:04:14 2016
@@ -70,6 +70,7 @@
         my $courseid=$env{'request.course.id'};
         my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
         &Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
+        my $needsdeval;
         foreach my $escsymb (split(/\|\|\|/,$helper->{'VARS'}{'delete'})) {
 	    my $symb=&Apache::lonnet::unescape($escsymb);
             my $key = "$courseid\0$symb";
@@ -103,15 +104,20 @@
                             if (($userreply->[1] eq 'map') || ($userreply->[1] eq 'resource')) {
                                 my %storecontent=($storeunder         => $userreply->[0],
                                                   $storeunder.'.type' => 'date_interval');
-                                &Apache::lonnet::del
-                                    ('resourcedata',[keys(%storecontent)],$udom,$uname);
-                                &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+                                if (&Apache::lonnet::del
+                                       ('resourcedata',[keys(%storecontent)],$udom,$uname) eq 'ok') {
+                                    &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+                                    $needsdeval = 1;
+                                }
                             }
                         }
                     }
                 }
             }
 	}
+        if ($needsdeval) {
+            &Apache::lonnet::devalidateuserresdata($uname,$udom);
+        }
         $result=~s/<li>$//;
         return $result;
       </finalcode>
@@ -172,6 +178,7 @@
             $storeunder = $env{'request.course.id'}.'.'.$symb.'.0.interval';
             $what = [$storeunder,'resource'];
         }
+        my %donedeval;
 	foreach my $name (@names) {
 	    my ($uname,$udom,$sec,$fullname)=split(':',$name);
 	    if (!$fullname) { $fullname="$uname\@$udom"; }
@@ -198,9 +205,14 @@
                             if (($userreply->[1] eq 'map') || ($userreply->[1] eq 'resource')) {
                                 my %storecontent=($storeunder         => $userreply->[0],
                                                   $storeunder.'.type' => 'date_interval');
-                                my $reply = &Apache::lonnet::del
-                                    ('resourcedata',[keys(%storecontent)],$udom,$uname);
-                                &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+                                if (&Apache::lonnet::del
+                                       ('resourcedata',[keys(%storecontent)],$udom,$uname) eq 'ok') {
+                                    &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+                                    unless ($donedeval{$uname.':'.$udom}) {
+                                        &Apache::lonnet::devalidateuserresdata($uname,$udom);
+                                        $donedeval{$uname.':'.$udom} = 1;
+                                    }
+                                }
                             }
                         }
                     }




More information about the LON-CAPA-cvs mailing list