Example #1
0
def issues_activity(owner, repo):
    index = index_name(owner, repo)
    mode = request.args.get('mode', 'weekly')
    if mode == 'weekly':
        opened = queries.past_n_weeks(index, partial(queries.issue_events_count, action='opened'), CHART_INTERVALS)
        closed = queries.past_n_weeks(index, partial(queries.issue_events_count, action='closed'), CHART_INTERVALS)
        data = {'opened': opened, 'closed': closed}
    elif mode == 'monthly':
        opened = queries.past_n_months(index, partial(queries.issue_events_count, action='opened'), CHART_INTERVALS)
        closed = queries.past_n_months(index, partial(queries.issue_events_count, action='closed'), CHART_INTERVALS)
        data = {'opened': opened, 'closed': closed}
    else:
        data = 'Mode not supported. Use ?mode=weekly or monthly'
    return jsonify(data=data)
Example #2
0
def popularity_evolution(owner, repo):
    index = index_name(owner, repo)
    mode = request.args.get('mode', 'weekly')
    if mode == 'weekly':
        data = queries.past_n_weeks(index, queries.popularity_events, CHART_INTERVALS)
    elif mode == 'monthly':
        data = queries.past_n_months(index, queries.popularity_events, CHART_INTERVALS)
    else:
        data = 'Mode not supported. Use ?mode=weekly or monthly'
    return jsonify(data=data)
Example #3
0
def avg_issue_time(owner, repo):
    index = index_name(owner, repo)
    mode = request.args.get('mode', 'weekly')
    if mode == 'weekly':
        times = queries.past_n_weeks(index, queries.avg_issue_time, CHART_INTERVALS)
    elif mode == 'monthly':
        times = queries.past_n_months(index, queries.avg_issue_time, CHART_INTERVALS)
    else:
        times = 'Mode not supported. Use ?mode=weekly or monthly'
    return jsonify(data=times)
Example #4
0
def popularity_evolution(owner, repo):
    index = index_name(owner, repo)
    mode = request.args.get('mode', 'weekly')
    if mode == 'weekly':
        data = queries.past_n_weeks(index, queries.popularity_events,
                                    CHART_INTERVALS)
    elif mode == 'monthly':
        data = queries.past_n_months(index, queries.popularity_events,
                                     CHART_INTERVALS)
    else:
        data = 'Mode not supported. Use ?mode=weekly or monthly'
    return jsonify(data=data)
Example #5
0
def avg_issue_time(owner, repo):
    index = index_name(owner, repo)
    mode = request.args.get('mode', 'weekly')
    if mode == 'weekly':
        times = queries.past_n_weeks(index, queries.avg_issue_time,
                                     CHART_INTERVALS)
    elif mode == 'monthly':
        times = queries.past_n_months(index, queries.avg_issue_time,
                                      CHART_INTERVALS)
    else:
        times = 'Mode not supported. Use ?mode=weekly or monthly'
    return jsonify(data=times)
Example #6
0
def issues_activity(owner, repo):
    index = index_name(owner, repo)
    mode = request.args.get('mode', 'weekly')
    if mode == 'weekly':
        opened = queries.past_n_weeks(
            index, partial(queries.issue_events_count, action='opened'),
            CHART_INTERVALS)
        closed = queries.past_n_weeks(
            index, partial(queries.issue_events_count, action='closed'),
            CHART_INTERVALS)
        data = {'opened': opened, 'closed': closed}
    elif mode == 'monthly':
        opened = queries.past_n_months(
            index, partial(queries.issue_events_count, action='opened'),
            CHART_INTERVALS)
        closed = queries.past_n_months(
            index, partial(queries.issue_events_count, action='closed'),
            CHART_INTERVALS)
        data = {'opened': opened, 'closed': closed}
    else:
        data = 'Mode not supported. Use ?mode=weekly or monthly'
    return jsonify(data=data)