Exemplo n.º 1
0
def iteration_burndown(request, group_slug, iteration_id):
    project = get_object_or_404( Project, slug=group_slug )
    read_access_or_403(project, request.user )
    iteration = get_object_or_404( Iteration, id=iteration_id )
    if iteration.start_date:
        start_date_timestamp = int((time.mktime(iteration.start_date.timetuple()) - time.timezone)*1000)
    if iteration.end_date:
        end_date_timestamp = int((time.mktime(iteration.end_date.timetuple()) - time.timezone)*1000)
    has_startdate_data = False
    has_enddate_data = False
    highest_total_points = 0
    last_total_points = 0

    total_points = [];
    claimed_points = [];

    for log in iteration.points_log.all():
        
        if iteration.start_date:
            if log.timestamp() != start_date_timestamp and not has_startdate_data :
                total_points.append( [start_date_timestamp, 0])
                claimed_points.append( [start_date_timestamp, 0])
        has_startdate_data = True
        last_total_points = log.points_total
        if iteration.end_date:
            if log.timestamp() == end_date_timestamp :
                has_enddate_data = True
        if highest_total_points < log.points_total:
            highest_total_points = log.points_total
        total_points.append( [log.timestamp(), log.points_total] );
        claimed_points.append( [log.timestamp(), log.points_claimed] );
    if not has_enddate_data and iteration.end_date:
        total_points.append( [end_date_timestamp, highest_total_points])
        
    if iteration.start_date:
        total_points = filter(lambda x:x[0]>=start_date_timestamp, total_points)
        claimed_points = filter(lambda x:x[0]>=start_date_timestamp, claimed_points)
    if iteration.end_date:
        total_points = filter(lambda x:x[0]<=end_date_timestamp, total_points)
        claimed_points = filter(lambda x:x[0]<=end_date_timestamp, claimed_points)

    total_stats = { "label":"Total Points", "data":reduce_burndown_data(total_points)}
    claimed_stats = { "label":"Claimed Points", "data":reduce_burndown_data(claimed_points)}

    json_serializer = serializers.get_serializer("json")()
    result = json.dumps([total_stats,claimed_stats])
    return HttpResponse(result) #, mimetype='application/json'
Exemplo n.º 2
0
def project_burndown(request, group_slug):
    project = get_object_or_404( Project, slug=group_slug )
    read_access_or_403(project, request.user )
    total_points = [];
    claimed_points = [];

    for log in project.points_log.all():
        total_points.append( [log.timestamp(), log.points_total] );
        claimed_points.append( [log.timestamp(), log.points_claimed] );

    total_stats = { "label":"Total Points", "data":reduce_burndown_data(total_points)}
    claimed_stats = { "label":"Claimed Points", "data":reduce_burndown_data(claimed_points)}


    json_serializer = serializers.get_serializer("json")()
    result = json.dumps([ total_stats , claimed_stats ])
    return HttpResponse(result) #, mimetype='application/json'
Exemplo n.º 3
0
def project_burndown(request, group_slug):
    project = get_object_or_404( Project, slug=group_slug )
    read_access_or_403(project, request.user )
    total_points = [];
    claimed_points = [];

    for log in project.points_log.all():
        total_points.append( [log.timestamp(), log.points_total] );
        claimed_points.append( [log.timestamp(), log.points_claimed] );

    total_stats = { "label":"Total Points", "data":reduce_burndown_data(total_points)}
    claimed_stats = { "label":"Claimed Points", "data":reduce_burndown_data(claimed_points)}


    json_serializer = serializers.get_serializer("json")()
    result = json.dumps([ total_stats , claimed_stats ])
    return HttpResponse(result) #, mimetype='application/json'