now if a task has subs, it will remain locked forever.
authornishanth
Mon, 01 Mar 2010 02:09:00 +0530
changeset 155 52958289d81f
parent 154 420f974328cc
child 156 7cad1e92713d
now if a task has subs, it will remain locked forever.
taskapp/utilities/task.py
taskapp/views/task.py
--- a/taskapp/utilities/task.py	Sun Feb 28 22:58:58 2010 +0530
+++ b/taskapp/utilities/task.py	Mon Mar 01 02:09:00 2010 +0530
@@ -27,8 +27,10 @@
     deps, subs = task.deps, task.subs
     if deps and task.status in ["OP", "LO"]:
         task.status = "OP" if all(map(lambda t:t.status=="CM",deps)) else "LO"
-    if subs and task.status in ["OP", "LO", "CM"]:
-        task.status = "CM" if all(map(lambda t:t.status=="CM",subs)) else "LO"
+
+    ## a task with subs will remain in "LO" and will be made "OP" only if all subs are removed.
+    if subs and task.status in ["OP", "LO"]:
+        task.status = "LO"
 
     task.save()
     return task
--- a/taskapp/views/task.py	Sun Feb 28 22:58:58 2010 +0530
+++ b/taskapp/views/task.py	Mon Mar 01 02:09:00 2010 +0530
@@ -63,13 +63,11 @@
 
     if task.status == "DL":
         return show_msg(user, 'This task no longer exists', '/task/browse/','browse the tasks')
-    comments = task.comment_set.filter(is_deleted=False)
+    comments = task.comment_set.filter(is_deleted=False).order_by('creation_datetime')
     mentors = task.mentors.all()
 
     deps, subs = task.deps, task.subs
     
-    errors = []
-    
     is_guest = True if not user.is_authenticated() else False
     is_mentor = True if user in task.mentors.all() else False
     context = {'user':user,
@@ -80,11 +78,10 @@
                'deps':deps,
                'is_guest':is_guest,
                'is_mentor':is_mentor,
-               'errors':errors,
               }
 
     context['can_publish'] = True if task.status == "UP" and user == task.created_by else False
-    context['task_viewable'] = True if ( task.status != "DL" ) or is_mentor else False
+    context['task_viewable'] = True if ( task.status != "UP" ) or is_mentor else False
     context['task_claimable'] = True if task.status in ["OP", "WR"] else False
 
     context['can_mod_mentors'] = True if task.status in ["UP", "OP", "LO", "WR"] and is_mentor else False