Put birthdays back on the list of upcoming birthdays, if their 
notifications have already been sent.

        Patch by kareila. 

diffs (23 lines):

diff -r ee7de5f9dd15 -r c7dfa9c29068 cgi-bin/DW/User/Edges/WatchTrust.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust.pm       Sat Sep 05 11:33:28 2009 +0000
+++ b/cgi-bin/DW/User/Edges/WatchTrust.pm       Sat Sep 05 12:12:35 2009 +0000
@@ -400,6 +400,19 @@ sub get_birthdays {
     # hash slice for array sorted by date
     my @bdays = @timedata{ sort keys %timedata };
 
+    # birthdays that have already had notifications sent
+    # are sorted to the end, so check for those and rewrap
+    while ( my $last = pop( @bdays ) ) {
+        if ( ( $last->[0] == $mnow &&   # this month
+               $last->[1] >= $dnow ) || # today or later
+             ( $last->[0] == ( $mnow % 12 ) + 1 ) ) {  # next month
+            unshift( @bdays, $last );
+        } else {  # put it back and exit
+            push( @bdays, $last );
+            last;
+        }
+    }
+
     # set birthdays in memcache for later
     LJ::MemCache::set($memkey, \...@bdays, 86400);
 
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to