def delete_sprint(project, id):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(id))

    sprint.delete()

    return '', 201
Exemplo n.º 2
0
def new_task(project):
    project = helpers.require_project(project)
    input = helpers.get_input()

    sprint = Sprint.get(project.id, input['sprint_id'])

    id = str(uuid.uuid4())

    data = {
        'sprint_id': sprint.id,
        'swimlane_id': input['swimlane_id'],
        'state': input['state'],
        'name': input['name'],
        'description':
        input['description'] if input['description'] != '' else None,
        'planned_points': input['planned_points'],
        'points': input['points'],
        'assigned_members':
        set(input['assigned_members']) & project.all_members()
    }

    task = Task(project.id, id, **data)
    task.save()

    return jsonify(dict(task))
def get_sprint_with_tasks(project, id):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(id))
    
    output = dict(sprint)
    output['tasks'] = [dict(x) for x in Task.sprint_index.query(project.id, Task.sprint_id == sprint.id)]

    return jsonify(output)
def get_swimlane(project, sprint, id):
    id = str(id)
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(sprint))
    swimlanes = sprint.swimlanes if sprint.swimlanes is not None else []
    swimlane = next(x for x in swimlanes if x.id == id)

    return jsonify(dict(swimlane.output_dict(sprint)))
def delete_swimlane(project, sprint, id):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(sprint))
    id = str(id)
    swimlanes = sprint.swimlanes if sprint.swimlanes is not None else []
    swimlanes = [x for x in swimlanes if x.id != id]

    sprint.swimlanes = swimlanes
    sprint.save()

    return '', 201
def edit_sprint(project, id):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(id))
    input = helpers.get_input()

    start_date = datetime.datetime.strptime(input['start_date'], '%Y-%m-%d')
    end_date = datetime.datetime.strptime(input['end_date'], '%Y-%m-%d')
    name = input['name']

    sprint.name = name
    sprint.start_date = start_date
    sprint.end_date = end_date
    sprint.save()

    return jsonify(dict(sprint))
def edit_swimlane(project, sprint, id):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(sprint))
    id = str(id)
    input = helpers.get_input()
    swimlanes = sprint.swimlanes if sprint.swimlanes is not None else []
    swimlane = next(x for x in swimlanes if x.id == id)

    description = input['description'] if input['description'] != '' else None
    name = input['name']
    points = input['points']

    swimlane.description = description
    swimlane.name = name
    swimlane.points = points

    sprint.swimlanes = swimlanes
    sprint.save()

    return jsonify(dict(swimlane.output_dict(sprint)))
def new_swimlane(project, sprint):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(sprint))
    input = helpers.get_input()
    swimlanes = sprint.swimlanes if sprint.swimlanes is not None else []

    id = str(uuid.uuid4())
    description = input['description'] if input['description'] != '' else None
    name = input['name']
    points = input['points']

    swimlane = Swimlane(id=id,
                        description=description,
                        name=name,
                        points=points)
    print(swimlane.description)
    swimlanes.append(swimlane)

    sprint.swimlanes = swimlanes
    sprint.save()

    return jsonify(dict(swimlane.output_dict(sprint)))
def get_sprint(project, id):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(id))
    
    return jsonify(dict(sprint))
def get_swimlanes(project, sprint):
    project = helpers.require_project(project)
    sprint = Sprint.get(project.id, str(sprint))
    swimlanes = sprint.swimlanes if sprint.swimlanes is not None else []

    return jsonify([dict(x.output_dict(sprint)) for x in swimlanes])