# @todo Look into using a button for notes and links, and labels for all else
currentProject = self._get_project()
projId = self._manager.lookup_project(currentProject)["id"]
- for taskDetails in self._manager.get_tasks_with_details(projId):
+ sortedTasks = list(self._manager.get_tasks_with_details(projId))
+ sortedTasks.sort(key = lambda taskDetails: (taskDetails["priority"].get_nothrow(1000), taskDetails["dueDate"].get_nothrow(datetime.datetime.max)))
+ for taskDetails in sortedTasks:
show = self._showCompleted if taskDetails["isCompleted"] else self._showIncomplete
if not show:
continue
id = taskDetails["id"]
isCompleted = taskDetails["isCompleted"]
name = abbreviate(taskDetails["name"], 100)
- priority = taskDetails["priority"]
- dueDescription = taskDetails["dueDate"]
- if dueDescription:
- dueDate = datetime.datetime.strptime(dueDescription, "%Y-%m-%dT%H:%M:%SZ")
+ priority = str(taskDetails["priority"].get_nothrow(""))
+ if taskDetails["dueDate"].is_good():
+ dueDate = taskDetails["dueDate"].get()
+ dueDescription = dueDate.strftime("%Y-%m-%d %H:%M:%S")
fuzzyDue = toolbox.to_fuzzy_date(dueDate)
else:
+ dueDescription = ""
fuzzyDue = ""
linkDisplay = taskDetails["url"]