[Rt-commit] r19814 - rt/3.8/trunk/sbin

sartak at bestpractical.com sartak at bestpractical.com
Mon Jun 1 11:21:06 EDT 2009


Author: sartak
Date: Mon Jun  1 11:21:05 2009
New Revision: 19814

Modified:
   rt/3.8/trunk/sbin/rt-email-dashboards.in

Log:
Pull out the value of Counter only once

Modified: rt/3.8/trunk/sbin/rt-email-dashboards.in
==============================================================================
--- rt/3.8/trunk/sbin/rt-email-dashboards.in	(original)
+++ rt/3.8/trunk/sbin/rt-email-dashboards.in	Mon Jun  1 11:21:05 2009
@@ -149,6 +149,7 @@
     # look through this user's subscriptions, are any supposed to be generated
     # right now?
     for my $subscription ($user->Attributes->Named('Subscription')) {
+        my $counter = $subscription->SubValue('Counter') || 0;
 
         if (!$opts{all}) {
             debug "Checking against subscription with frequency [_1], hour [_2], dow [_3], dom [_4]",
@@ -163,10 +164,9 @@
             # if weekly, correct day of week?
             if ( $subscription->SubValue('Frequency') eq 'weekly' ) {
                 next if $subscription->SubValue('Dow') ne $dow;
-                my $counter = $subscription->SubValue('Counter') || 0;
                 my $fow       = $subscription->SubValue('Fow') || 1;
                 if ( $counter % $fow ) {
-                    $subscription->SetSubValues( Counter => $counter+1 )
+                    $subscription->SetSubValues( Counter => $counter + 1 )
                       unless $opts{'dryrun'};
                     next;
                 }
@@ -191,7 +191,7 @@
         }
         else {
             $subscription->SetSubValues(
-                Counter => ($subscription->SubValue('Counter')||0) + 1 )
+                Counter => $counter + 1 )
               unless $opts{'dryrun'};
         }
     }


More information about the Rt-commit mailing list