public
Description: Tracks is a GTD(TM) web application, built with Ruby on Rails
Homepage: http://www.rousette.org.uk/projects/
Clone URL: git://github.com/bsag/tracks.git
Click here to lend your support to: tracks and make a donation at www.pledgie.com !
lrbalt (author)
Sat Nov 29 06:55:16 -0800 2008
commit  9d246f70cd515f3bea6774e72eda0c1424da2149
tree    151f45fb1afdb0c432d3be5f339136abd4e064f8
parent  9147fb887cfd94d6ad50de2a4300458a215a9405
...
779
780
781
782
783
 
 
784
785
786
...
788
789
790
791
 
792
793
794
...
799
800
801
802
 
803
804
805
...
779
780
781
 
 
782
783
784
785
786
...
788
789
790
 
791
792
793
794
...
799
800
801
 
802
803
804
805
0
@@ -779,8 +779,8 @@ class TodosController < ApplicationController
0
     if todo.from_recurring_todo?
0
       recurring_todo = todo.recurring_todo
0
 
0
-      # check if there are active todos belonging to this recurring todo.
0
-      # only add new one if all active todos are completed
0
+      # check if there are active todos belonging to this recurring todo. only
0
+      # add new one if all active todos are completed
0
       if recurring_todo.todos.active.count == 0
0
       
0
         # check for next todo either from the due date or the show_from date
0
@@ -788,7 +788,7 @@ class TodosController < ApplicationController
0
       
0
         # if both due and show_from are nil, check for a next todo from now
0
         date_to_check = Time.zone.now if date_to_check.nil?
0
-      
0
+
0
         if recurring_todo.active? && recurring_todo.has_next_todo(date_to_check)
0
         
0
           # shift the reference date to yesterday if date_to_check is furher in
0
@@ -799,7 +799,7 @@ class TodosController < ApplicationController
0
           # that new todos due for today will be created instead of new todos
0
           # for tomorrow.
0
           date = date_to_check.at_midnight >= Time.zone.now.at_midnight ? date_to_check : Time.zone.now-1.day
0
-        
0
+
0
           new_recurring_todo = create_todo_from_recurring_todo(recurring_todo, date)
0
         end
0
       end
...
471
472
473
474
 
475
476
477
 
478
479
 
 
 
 
 
 
 
 
 
 
 
 
480
481
482
...
471
472
473
 
474
475
476
 
477
478
 
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
0
@@ -471,12 +471,23 @@ class RecurringTodo < ActiveRecord::Base
0
     start = determine_start(previous)
0
     day = self.every_other1
0
     n = self.every_other2
0
-    
0
+
0
     case self.recurrence_selector
0
     when 0 # specific day of the month
0
-      if start.mday >= day  
0
+      if start.mday >= day
0
         # there is no next day n in this month, search in next month
0
-        start += n.months
0
+        #  
0
+        #  start += n.months
0
+        # 
0
+        # The above seems to not work. Fiddle with timezone. Looks like we hit a
0
+        # bug in rails here where 2008-12-01 +0100 plus 1.month becomes
0
+        # 2008-12-31 +0100. For now, just calculate in UTC and convert back to
0
+        # local timezone.
0
+        #  
0
+        #  TODO: recheck if future rails versions have this problem too
0
+        start = Time.utc(start.year, start.month, start.day)+n.months
0
+        start = Time.zone.local(start.year, start.month, start.day)
0
+
0
         # go back to day
0
       end
0
       return Time.zone.local(start.year, start.month, day)

Comments