Пример #1
0
def coveys_matrix_page(request, tasklist_to_show_id=None):
    user_mail = request.session['user_mail']

    if tasklist_to_show_id:
        tasklist = TaskList.objects.get(id=tasklist_to_show_id)
        tasks = SimpleTask.get_tasks_from_tasklist(tasklist)
    else:
        tasks = SimpleTask.get_all_tasks_by_user(user_mail)

    backlog_tasks = SimpleTask.get_matrix_backlog_tasks(tasks)

    backlog_obj = BuildTemplateContext('all', backlog_tasks)
    final_backlog = backlog_obj.get_data()

    all_user_tasks = SimpleTask.get_all_tasks_by_user(user_mail)

    matrix_obj = BuildTemplateContext('matrix', all_user_tasks)
    matrix_data = matrix_obj.get_data()

    all_tasklists = TaskList.get_tasklists_from_user(user_mail)

    final_backlog['all_tasklists'] = all_tasklists

    return render(request, "stephen_covey_matrix.html", {
        'backlog': final_backlog,
        'matrix_data': matrix_data
    })
Пример #2
0
 def test_get_matrix_backlog_tasks_with_tasks_from_tasklist(self):
     tasklist_tasks = SimpleTask.objects.filter(tasklist=self.tasklist_2)
     tasks = SimpleTask.get_matrix_backlog_tasks(tasklist_tasks)
     for task in tasks:
         self.assertFalse(task.is_done)
         self.assertEquals(task.tasklist.user, self.user)
         self.assertTrue((task.is_urgent not in [True, False])
                         and (task.is_important not in [True, False]))
Пример #3
0
 def test_get_matrix_backlog_tasks_with_all_tasks_by_user(self):
     all_tasks = SimpleTask.get_all_tasks_by_user(self.user)
     tasks = SimpleTask.get_matrix_backlog_tasks(all_tasks)
     for task in tasks:
         self.assertFalse(task.is_done)
         self.assertEquals(task.tasklist.user, self.user)
         self.assertTrue((task.is_urgent not in [True, False])
                         and (task.is_important not in [True, False]))
Пример #4
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