Exemplo n.º 1
0
def set_finished(request):
    id = request.POST['task_id']
    task = SimpleTask.get_task_with_id(id)
    task.in_progress = False
    task.is_done = True
    task.save()
    return kanbanpage(request)
Exemplo n.º 2
0
def retire_task_from_matrix(request):
    id = request.POST['task_id']
    task = SimpleTask.get_task_with_id(id)
    task.is_important = None
    task.is_urgent = None
    task.save()
    return coveys_matrix_page(request)
Exemplo n.º 3
0
def change_task_state(request):
    id = request.POST['task_id']
    task = SimpleTask.get_task_with_id(id)
    task.is_done = not task.is_done
    task.save()
    if 'tasklist_to_show_id' in request.session:
        id = request.session['tasklist_to_show_id']
    else:
        id = None
    return tasks_dashboard(request, tasklist_to_show_id=id)
Exemplo n.º 4
0
def edit_task(request, id):
    task = SimpleTask.get_task_with_id(id=id)
    data = {
        "task_name": task.name,
        "task_id": task.id,
        "category_name": task.tasklist.name,
        "category_color": task.tasklist.color,
        "due_date": task.due_date,
        "description": task.description
    }
    return JsonResponse(data)
Exemplo n.º 5
0
def update_task(request):
    id = request.POST['task_id']
    task = SimpleTask.get_task_with_id(id)
    task.name = request.POST['name']
    task.due_date = request.POST['due_date']
    task.is_important = request.POST['importance']
    task.is_urgent = request.POST['emergency']

    if len(str(task.due_date)) > 5:
        task.due_date_clean_display = convert_to_clean_date(task.due_date)
        task.due_date = convert_into_date_type(str(task.due_date))
    else:
        task.due_date = None
        task.due_date_clean_display = None

    task.description = request.POST['description']
    new_category_id = request.POST['tasklists']
    new_tasklist = TaskList.get_tasklist_by_id(new_category_id)
    task.tasklist = new_tasklist
    task.save()
    return tasks_dashboard(request, tasklist_to_show_id=new_tasklist.id)
Exemplo n.º 6
0
def update_matrix_task(request):
    id = request.POST['task_id']
    dest = request.POST['destination']
    task = SimpleTask.get_task_with_id(id)

    if dest == 'top-left':
        task.is_important = True
        task.is_urgent = True

    elif dest == 'top-right':
        task.is_important = True
        task.is_urgent = False

    elif dest == 'bottom-left':
        task.is_important = False
        task.is_urgent = True

    elif dest == 'bottom-right':
        task.is_important = False
        task.is_urgent = False

    task.save()
    return coveys_matrix_page(request)
Exemplo n.º 7
0
def deltask(request):
    id = request.POST['task_id']
    SimpleTask.get_task_with_id(id).delete()
    return tasks_dashboard(request)
Exemplo n.º 8
0
 def test_get_task_with_id(self):
     first_task = SimpleTask.objects.all()[:1]
     task = SimpleTask.get_task_with_id(first_task[0].id)
     self.assertTrue(isinstance(task, SimpleTask))
     self.assertEquals(task.id, first_task[0].id)
Exemplo n.º 9
0
def cancel_in_progress(request):
    id = request.POST['task_id']
    task = SimpleTask.get_task_with_id(id)
    task.in_progress = False
    task.save()
    return kanbanpage(request)
Exemplo n.º 10
0
def change_matrix_task_state(request):
    id = request.POST['task_id']
    task = SimpleTask.get_task_with_id(id)
    task.is_done = not task.is_done
    task.save()
    return coveys_matrix_page(request)