示例#1
0
 def _tasks_request(self):
     tasks = Task.Recent(self.user)
     tasks_undone = []
     n_done = Task.CountCompletedSince(self.user, datetime.combine(datetime.today(), time(0,0)))
     for task in tasks:
         if not task.is_done():
             tasks_undone.append(task.title)
     if n_done:
         text = "You've completed %d %s for today." % (n_done, tools.pluralize('task', n_done))
     else:
         text = "You haven't completed any tasks yet."
     if tasks_undone:
         text += " You still need to do %s." % tools.english_list(tasks_undone)
     if not n_done and not tasks_undone:
         text += " Try adding tasks by saying 'add task Q2 planning'"
     return text