diff --git a/stackalytics/dashboard/reports.py b/stackalytics/dashboard/reports.py index 27d098a58..bf22d3e73 100644 --- a/stackalytics/dashboard/reports.py +++ b/stackalytics/dashboard/reports.py @@ -144,14 +144,41 @@ def open_reviews(module): } -@blueprint.route('/contribution//') +@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, } diff --git a/stackalytics/dashboard/templates/overview.html b/stackalytics/dashboard/templates/overview.html index 070cb098b..56d10dfa2 100644 --- a/stackalytics/dashboard/templates/overview.html +++ b/stackalytics/dashboard/templates/overview.html @@ -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 %}
Show open reviews for {{ module_inst.module_group_name }}
-
Contribution for the last 30 days in {{ module_inst.module_group_name }}
-
Contribution for the last 90 days in {{ module_inst.module_group_name }}
+
Contribution for the last 30 days in {{ module_inst.module_group_name }}
+
Contribution for the last 90 days in {{ module_inst.module_group_name }}
+ {% if company %} +
{{ company_original }} contribution in {{ module_inst.module_group_name }} during {{ format_releases(release) }}
+ {% else %} +
Contribution in {{ module_inst.module_group_name }} during {{ format_releases(release) }}
+ {% endif %}
Show activity report for {{ module }}
{% endif %} {% if company %} + {% if not module %} +
{{ company_original }} contribution during {{ format_releases(release) }}
+ {% endif %}
Show activity report for {{ company_original }}
{% endif %} {% if user_id %} diff --git a/stackalytics/dashboard/templates/reports/contribution.html b/stackalytics/dashboard/templates/reports/contribution.html index 5430a1504..13a993825 100644 --- a/stackalytics/dashboard/templates/reports/contribution.html +++ b/stackalytics/dashboard/templates/reports/contribution.html @@ -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 %} +{% endif %} {% endblock %} {% block content %} -

Contribution into {{ module }} for the last {{ days }} days

+

{{ title }}