[Rt-commit] r17121 - in rt/3.8/trunk: sbin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Dec 5 19:32:05 EST 2008


Author: sunnavy
Date: Fri Dec  5 19:32:05 2008
New Revision: 17121

Modified:
   rt/3.8/trunk/sbin/rt-email-dashboards.in
   rt/3.8/trunk/share/html/Dashboards/Subscription.html

Log:
use Counter instead of LastSent in dashboard subscription

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	Fri Dec  5 19:32:05 2008
@@ -160,10 +160,13 @@
             # if weekly, correct day of week?
             if ( $subscription->SubValue('Frequency') eq 'weekly' ) {
                 next if $subscription->SubValue('Dow') ne $dow;
-                my $last_sent = $subscription->SubValue('LastSent') || 0;
+                my $counter = $subscription->SubValue('Counter') || 0;
                 my $fow       = $subscription->SubValue('Fow') || 1;
-                # minus 120s in case of time inaccuracy when running cron
-                next if ( ( $now - $last_sent ) < 7 * 24 * 3600 * $fow - 120); 
+                if ( $counter % $fow ) {
+                    $subscription->SetSubValues( Counter => $counter+1 )
+                      unless $opts{'dryrun'};
+                    next;
+                }
             }
 
             # if monthly, correct day of month?
@@ -180,8 +183,9 @@
             error 'Caught exception: ' . $@;
         }
         else {
-            # update LastSent if dashboard is sent successfully.
-            $subscription->SetSubValues(LastSent => $now) unless $opts{'dryrun'};
+            $subscription->SetSubValues(
+                Counter => $subscription->SubValue('Counter') + 1 )
+              unless $opts{'dryrun'};
         }
     }
 }

Modified: rt/3.8/trunk/share/html/Dashboards/Subscription.html
==============================================================================
--- rt/3.8/trunk/share/html/Dashboards/Subscription.html	(original)
+++ rt/3.8/trunk/share/html/Dashboards/Subscription.html	Fri Dec  5 19:32:05 2008
@@ -213,7 +213,7 @@
     Rows        => 20,
     Recipient   => '',
     Fow         => 1,
-    LastSent    => 0,
+    Counter     => 0,
 );
 
 # update any fields with the values from the subscription object


More information about the Rt-commit mailing list