示例#1
0
 def test_get_future_tasks_with_all_tasks_by_user(self):
     tomorrow = date.today() + datetime.timedelta(days=1)
     all_tasks = SimpleTask.get_all_tasks_by_user(self.user)
     future_tasks = SimpleTask.get_future_tasks(all_tasks)
     for task in future_tasks:
         self.assertTrue(isinstance(task, SimpleTask))
         self.assertTrue(task.due_date > tomorrow)
         self.assertEquals(task.tasklist.user, self.user)
示例#2
0
 def test_get_future_tasks_with_tasks_from_tasklist(self):
     tomorrow = date.today() + datetime.timedelta(days=1)
     tasklist_tasks = SimpleTask.objects.filter(tasklist=self.tasklist_1)
     future_tasks = SimpleTask.get_future_tasks(tasklist_tasks)
     for task in future_tasks:
         self.assertTrue(isinstance(task, SimpleTask))
         self.assertTrue(task.due_date > tomorrow)
         self.assertEquals(task.tasklist.user, self.user)
示例#3
0
    def get_data(self):
        overdue_tasks = SimpleTask.get_overdue_tasks(self.tasks)
        due_today_tasks = SimpleTask.get_today_tasks(self.tasks)
        due_tommorow_tasks = SimpleTask.get_tomorrow_tasks(self.tasks)
        future_tasks = SimpleTask.get_future_tasks(self.tasks)
        no_date_tasks = SimpleTask.get_no_date_tasks(self.tasks)
        finished_tasks = SimpleTask.get_finished_tasks(self.tasks)
        urgent_tasks = SimpleTask.get_urgent_tasks(self.tasks)
        important_tasks = SimpleTask.get_important_tasks(self.tasks)

        important_urgent = SimpleTask.get_important_urgent_tasks(self.tasks)
        important_non_urgent = SimpleTask.get_important_non_urgent_tasks(
            self.tasks)
        non_important_urgent = SimpleTask.get_non_important_urgent_tasks(
            self.tasks)
        non_important_non_urgent = SimpleTask. \
            get_non_important_non_urgent_tasks(self.tasks)

        matrix_backlog = SimpleTask.get_matrix_backlog_tasks(self.tasks)

        all_data = {
            'overdue_tasks': overdue_tasks,
            'due_today_tasks': due_today_tasks,
            'due_tommorow_tasks': due_tommorow_tasks,
            'future_tasks': future_tasks,
            'no_date_tasks': no_date_tasks,
            'finished_tasks': finished_tasks,
            'urgent_tasks': urgent_tasks,
            'important_tasks': important_tasks,
            'important_urgent': important_urgent,
            'important_non_urgent': important_non_urgent,
            'non_important_urgent': non_important_urgent,
            'non_important_non_urgent': non_important_non_urgent,
            'matrix_backlog': matrix_backlog
        }

        dict = {}
        keys_list = self.__content_to_return()

        for k, v in all_data.items():
            if k in keys_list:
                dict[k] = v

        return dict