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

falcone at bestpractical.com falcone at bestpractical.com
Sun Dec 7 10:06:51 EST 2008


Author: falcone
Date: Sun Dec  7 10:06:51 2008
New Revision: 17139

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

Log:


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	Sun Dec  7 10:06:51 2008
@@ -160,13 +160,10 @@
             # 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 $last_sent = $subscription->SubValue('LastSent') || 0;
                 my $fow       = $subscription->SubValue('Fow') || 1;
-                if ( $counter % $fow ) {
-                    $subscription->SetSubValues( Counter => $counter+1 )
-                      unless $opts{'dryrun'};
-                    next;
-                }
+                # minus 120s in case of time inaccuracy when running cron
+                next if ( ( $now - $last_sent ) < 7 * 24 * 3600 * $fow - 120); 
             }
 
             # if monthly, correct day of month?
@@ -183,9 +180,8 @@
             error 'Caught exception: ' . $@;
         }
         else {
-            $subscription->SetSubValues(
-                Counter => $subscription->SubValue('Counter') + 1 )
-              unless $opts{'dryrun'};
+            # update LastSent if dashboard is sent successfully.
+            $subscription->SetSubValues(LastSent => $now) 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	Sun Dec  7 10:06:51 2008
@@ -213,7 +213,7 @@
     Rows        => 20,
     Recipient   => '',
     Fow         => 1,
-    Counter     => 0,
+    LastSent    => 0,
 );
 
 # update any fields with the values from the subscription object


More information about the Rt-commit mailing list