← Back to team overview

gtg team mailing list archive

[Merge] lp:~nimit-svnit/gtg/bug-816356 into lp:gtg

 

Nimit Shah has proposed merging lp:~nimit-svnit/gtg/bug-816356 into lp:gtg.

Requested reviews:
  Gtg developers (gtg)
Related bugs:
  Bug #816356 in Getting Things GNOME!: "When sorting by due-date, use the closest date of all children"
  https://bugs.launchpad.net/gtg/+bug/816356

For more details, see:
https://code.launchpad.net/~nimit-svnit/gtg/bug-816356/+merge/164133

Fix for bug-816356
Added a recursive function get_urgent_date, which gets the closest due date among all the subtasks of the task and the task itself.
It helps in sorting the tasks by the most urgent_date, which is the problem mentioned in the bug post.
-- 
https://code.launchpad.net/~nimit-svnit/gtg/bug-816356/+merge/164133
Your team Gtg developers is requested to review the proposed merge of lp:~nimit-svnit/gtg/bug-816356 into lp:gtg.
=== modified file 'CHANGELOG'
--- CHANGELOG	2013-03-09 16:59:30 +0000
+++ CHANGELOG	2013-05-16 09:23:47 +0000
@@ -17,6 +17,7 @@
     * Pep8ification of code, by Nimit Shah
     * Fix for bug #1141582: Crash on enabling hamster plugin, by Nimit Shah
     * System level global shortcut key for quick adding task, by Parin Porecha
+    * Fix for bug #816356: When sorting by due-date, use the closest date of all children, by Nimit Shah
 
 2012-11-06 Getting Things GNOME! 0.3
     * Hide tasks with due date someday, #931376

=== modified file 'GTG/core/task.py'
--- GTG/core/task.py	2013-02-25 07:35:07 +0000
+++ GTG/core/task.py	2013-05-16 09:23:47 +0000
@@ -357,6 +357,15 @@
     def get_due_date(self):
         """ Returns the due date, which always respects all constraints """
         return self.due_date
+        
+    def get_urgent_date(self):
+        """ Returns the most urgent due date among the task and it's subtasks """
+        urg_date = self.due_date
+        for sub in self.get_subtasks():
+            sub_urg_date = sub.get_urgent_date()
+            if urg_date >= sub_urg_date:
+                urg_date = sub_urg_date
+        return urg_date
 
     def get_due_date_constraint(self):
         """ Returns the most urgent due date constraint, following

=== modified file 'GTG/gtk/browser/treeview_factory.py'
--- GTG/gtk/browser/treeview_factory.py	2013-02-25 07:35:07 +0000
+++ GTG/gtk/browser/treeview_factory.py	2013-05-16 09:23:47 +0000
@@ -162,8 +162,8 @@
                 t1 = task1.get_start_date()
                 t2 = task2.get_start_date()
             elif para == 'due':
-                t1 = task1.get_due_date()
-                t2 = task2.get_due_date()
+                t1 = task1.get_urgent_date()
+                t2 = task2.get_urgent_date()
                 if t1 == Date.no_date():
                     t1 = task1.get_due_date_constraint()
                 if t2 == Date.no_date():


Follow ups