Exemplo n.º 1
0
Arquivo: task.py Projeto: an/GTGOnline
def change_task_tree_status(user, task, new_status):
    if new_status == IS_ACTIVE:
        new_closed_date = None
    else:
        new_closed_date = get_current_datetime_object()
    task.subtasks.all().update(status = new_status, \
                               closed_date = new_closed_date)
    for index, subtask in enumerate(task.subtasks.all()):
        if subtask.shared_with.exists():
            update_log(user, subtask, LOG_TASK_STATUS, new_status = new_status)
        change_task_tree_status(user, subtask, new_status)
Exemplo n.º 2
0
Arquivo: task.py Projeto: an/GTGOnline
def change_task_status(user, task_id, new_status, task = None):
    if task == None:
        task = get_task_object(user, task_id)
    if task == None:
        return None
    task.status = new_status
    
    if new_status == IS_ACTIVE:
        task.closed_date = None
    else:
        task.closed_date = get_current_datetime_object()
    
    task.save()
    if task.shared_with.exists():
        update_log(user, task, LOG_TASK_STATUS, new_status = new_status)
    return task