summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornishanth2010-03-01 02:09:00 +0530
committernishanth2010-03-01 02:09:00 +0530
commit87428b64d3a02ce6bde8df83a0ffb115440ecaa7 (patch)
tree426e47d00deafa7f9f015bc0379773c1f2df7cdb
parent83a0349462fa2459cf45d3ad0d7b69a7b3a27730 (diff)
downloadpytask-87428b64d3a02ce6bde8df83a0ffb115440ecaa7.tar.gz
pytask-87428b64d3a02ce6bde8df83a0ffb115440ecaa7.tar.bz2
pytask-87428b64d3a02ce6bde8df83a0ffb115440ecaa7.zip
now if a task has subs, it will remain locked forever.
-rw-r--r--taskapp/utilities/task.py6
-rw-r--r--taskapp/views/task.py7
2 files changed, 6 insertions, 7 deletions
diff --git a/taskapp/utilities/task.py b/taskapp/utilities/task.py
index b5da99e..3a7ebdf 100644
--- a/taskapp/utilities/task.py
+++ b/taskapp/utilities/task.py
@@ -27,8 +27,10 @@ def getTask(tid):
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
diff --git a/taskapp/views/task.py b/taskapp/views/task.py
index b9889da..eae2720 100644
--- a/taskapp/views/task.py
+++ b/taskapp/views/task.py
@@ -63,13 +63,11 @@ def view_task(request, tid):
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 @@ def view_task(request, tid):
'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