Merge "Add contribution table that respects chosen release"
This commit is contained in:
@@ -144,14 +144,41 @@ def open_reviews(module):
|
||||
}
|
||||
|
||||
|
||||
@blueprint.route('/contribution/<module>/<days>')
|
||||
@blueprint.route('/contribution')
|
||||
@decorators.templated()
|
||||
@decorators.exception_handler()
|
||||
def contribution(module, days):
|
||||
def contribution():
|
||||
args = flask.request.args
|
||||
company = args.get('company')
|
||||
module = args.get('module')
|
||||
release = args.get('release')
|
||||
days = args.get('days')
|
||||
title = "Contribution"
|
||||
start_date = None
|
||||
if company:
|
||||
memory_storage_inst = vault.get_memory_storage()
|
||||
original_name = memory_storage_inst.get_original_company_name(company)
|
||||
title = original_name + " contribution"
|
||||
if module:
|
||||
title += " in " + module
|
||||
if days:
|
||||
title += " during the recent " + days + " days"
|
||||
start_date = int(time.time()) - int(days) * 24 * 60 * 60
|
||||
if release:
|
||||
title += " during %s release"
|
||||
if release != 'all':
|
||||
release = release.capitalize()
|
||||
else:
|
||||
release = release
|
||||
title += 's'
|
||||
title %= release
|
||||
return {
|
||||
'company': company,
|
||||
'module': module,
|
||||
'release': release,
|
||||
'days': days,
|
||||
'start_date': int(time.time()) - int(days) * 24 * 60 * 60
|
||||
'start_date': start_date,
|
||||
'title': title,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,14 +18,26 @@
|
||||
{% set show_module_details = (module) %}
|
||||
{% set show_review_ratio = (metric in ['marks']) %}
|
||||
|
||||
{% macro format_releases(release) -%}
|
||||
{% if release != "all" %}{{ release|capitalize }} release{% else %}all releases{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro show_report_links(module=None, company=None, user_id=None) -%}
|
||||
{% if module %}
|
||||
<div><b><a href="/report/reviews/{{ module }}/open" target="_blank">Show open reviews for {{ module_inst.module_group_name }}</a></b></div>
|
||||
<div><b><a href="/report/contribution/{{ module }}/30" target="_blank">Contribution for the last 30 days in {{ module_inst.module_group_name }}</a></b></div>
|
||||
<div><b><a href="/report/contribution/{{ module }}/90" target="_blank">Contribution for the last 90 days in {{ module_inst.module_group_name }}</a></b></div>
|
||||
<div><b><a href="/report/contribution?module={{ module }}&days=30" target="_blank">Contribution for the last 30 days in {{ module_inst.module_group_name }}</a></b></div>
|
||||
<div><b><a href="/report/contribution?module={{ module }}&days=90" target="_blank">Contribution for the last 90 days in {{ module_inst.module_group_name }}</a></b></div>
|
||||
{% if company %}
|
||||
<div><b><a href="/report/contribution?company={{ company }}&release={{ release }}&module={{ module }}" target="_blank">{{ company_original }} contribution in {{ module_inst.module_group_name }} during {{ format_releases(release) }}</a></b></div>
|
||||
{% else %}
|
||||
<div><b><a href="/report/contribution?release={{ release }}&module={{ module }}" target="_blank">Contribution in {{ module_inst.module_group_name }} during {{ format_releases(release) }}</a></b></div>
|
||||
{% endif %}
|
||||
<div><b><a href="/report/activity?module={{ module }}&project_type={{ project_type }}&release={{ release }}" target="_blank">Show activity report for {{ module }}</a></b></div>
|
||||
{% endif %}
|
||||
{% if company %}
|
||||
{% if not module %}
|
||||
<div><b><a href="/report/contribution?company={{ company }}&release={{ release }}" target="_blank">{{ company_original }} contribution during {{ format_releases(release) }}</a></b></div>
|
||||
{% endif %}
|
||||
<div><b><a href="/report/companies/{{ company }}" target="_blank">Show activity report for {{ company_original }}</a></b></div>
|
||||
{% endif %}
|
||||
{% if user_id %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "reports/base_report.html" %}
|
||||
|
||||
{% set page_title = "Contribution into " + module + " during the recent " + days + " days" %}
|
||||
{% set page_title = title %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
@@ -21,6 +21,24 @@
|
||||
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
||||
}
|
||||
});
|
||||
var params = {
|
||||
'metric': 'marks',
|
||||
'project_type': 'all',
|
||||
'release': 'all',
|
||||
}
|
||||
{% if module %}
|
||||
params['module'] = "{{ module|safe }}";
|
||||
{% endif %}
|
||||
{% if company %}
|
||||
params['company'] = "{{ company|safe }}";
|
||||
{% endif %}
|
||||
{% if release %}
|
||||
params['release'] = "{{ release }}";
|
||||
{% endif %}
|
||||
{% if days %}
|
||||
params['days'] = "{{ days }}";
|
||||
params['start_date'] = "{{ start_date }}";
|
||||
{% endif %}
|
||||
|
||||
$(document).ready(function () {
|
||||
var table_column_names = ["index", "link", "metric", "-2", "-1", "1", "2", "A", "x", "positive_ratio", "disagreements", "disagreement_ratio",
|
||||
@@ -28,7 +46,7 @@
|
||||
var table_id = "review_stats_table";
|
||||
|
||||
$.ajax({
|
||||
url: makeURI("/api/1.0/stats/engineers_extended?project_type=all&metric=marks&module={{ module }}&release=all&start_date={{ start_date }}"),
|
||||
url: makeURI("/api/1.0/stats/engineers_extended", params),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
var tableData = data["stats"];
|
||||
@@ -122,6 +140,7 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
{% if days %}
|
||||
<script id="review_summary_template" type="text/x-jquery-tmpl">
|
||||
<h2>Review Summary</h2>
|
||||
<div>Total reviews: <b>${marks}</b> (${(marks / {{ days }}).toFixed(1) } per day)</div>
|
||||
@@ -134,11 +153,12 @@
|
||||
<div>Commits: <b>${commits}</b> (${(commits / {{ days }}).toFixed(1) } per day)</div>
|
||||
<div>Emails: <b>${emails}</b> (${(emails / {{ days }}).toFixed(1) } per day)</div>
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Contribution into {{ module }} for the last {{ days }} days</h1>
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<table id="review_stats_table">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user