Exemplo n.º 1
0
def _task_template_values(tasks, user, level=0):
    """
    Returns a list of dictionaries containing the template values for
    each task.

    Args:
        tasks: A list of Task model instance
        user: A User model instance

    Returns a list of dictionaries for each task, in the same order.
    """
    user_identifier = user.identifier()
    return [
        {
            'title': task.title(),
            # There are only 4 levels available in the css
            'level': min(level, 3),
            'completed': task.is_completed(),
            'is_assigned': task.assignee_key() != None,
            'can_assign_to_self': api.can_assign_to_self(task, user),
            'assignee_description': task.assignee_description(),
            'can_complete': api.can_complete_task(task, user),
            'summary': task.personalized_summary(user_identifier),
            'active': task.is_active(user_identifier),
            'atomic': task.atomic(),
            'id': task.identifier()
        } for task in tasks
    ]
Exemplo n.º 2
0
Arquivo: main.py Projeto: troberti/sps
def _task_template_values(tasks, user, level=0):
    """
    Returns a list of dictionaries containing the template values for
    each task.

    Args:
        tasks: A list of Task model instance
        user: A User model instance

    Returns a list of dictionaries for each task, in the same order.
    """
    user_identifier = user.identifier()
    return [{ 'title': task.title(),
              # There are only 4 levels available in the css
              'level': min(level, 3),
              'completed': task.is_completed(),
              'is_assigned': task.assignee_key() != None,
              'can_assign_to_self': api.can_assign_to_self(task, user),
              'assignee_description': task.assignee_description(),
              'can_complete': api.can_complete_task(task, user),
              'summary': task.personalized_summary(user_identifier),
              'remaining': task.subtasks_remaining(user_identifier),
              'active': task.is_active(user_identifier),
              'atomic': task.atomic(),
              'id': task.identifier() }
            for task in tasks]
Exemplo n.º 3
0
Arquivo: main.py Projeto: edrijver/sps
def _task_template_values(tasks, user):
    """
    Returns a list of dictionaries containing the template values for
    each task.

    Args:
        tasks: A list of Task model instance
        user: A User model instance

    Returns a list of dictionaries for each task, in the same order.
    """
    return [{ 'title': task.title(),
              'levels': range(task.level),
              'completed': task.completed,
              'is_assigned': task.assignee_key() != None,
              'can_assign_to_self': api.can_assign_to_self(task, user),
              'assignee_description': assignee_description(task),
              'can_complete': api.can_complete_task(task, user),
              'num_subtasks': task.number_of_subtasks,
              'id': task.identifier() }
            for task in tasks]
Exemplo n.º 4
0
Arquivo: main.py Projeto: edrijver/sps
def _task_template_values(tasks, user):
    """
    Returns a list of dictionaries containing the template values for
    each task.

    Args:
        tasks: A list of Task model instance
        user: A User model instance

    Returns a list of dictionaries for each task, in the same order.
    """
    return [{
        'title': task.title(),
        'levels': range(task.level),
        'completed': task.completed,
        'is_assigned': task.assignee_key() != None,
        'can_assign_to_self': api.can_assign_to_self(task, user),
        'assignee_description': assignee_description(task),
        'can_complete': api.can_complete_task(task, user),
        'num_subtasks': task.number_of_subtasks,
        'id': task.identifier()
    } for task in tasks]