{% extends "kpi/base_kpi.html" %}

{% block title %}
    Example of KPI report
{% endblock %}

{% block scripts %}
    <script type="text/javascript">
        'use strict';
        $(document).ready(function () {

            var month_ago = Math.round(Date.now() / 1000) - 60 * 60 * 24 * 30;

            goalPositionInTop("kpi_container_position", {release: "icehouse", metric: "commits", module: "openstack"},
                    "companies", "Mirantis", 5, "Be in top 5 by commits");
            goalPositionInTop("kpi_container_position", {release: "icehouse", metric: "marks", module: "openstack"},
                    "engineers", "boris-42", 5, "Be in top 5 by reviews");
            goalPositionInTop("kpi_container_position", {release: "icehouse", metric: "marks", module: "glance"},
                    "engineers", "boris-42", 3, "Be in top 3 among reviewers");

            goalPercentageInTopLessThan("kpi_container_percentage",
                    {release: "all", metric: "commits", project_type: "all", module: "stackalytics"},
                    "companies", "Mirantis", 0.8, "Mirantis contribution to Stackalytics is less than 80%");

            goalMetric("kpi_container_position", {release: "icehouse", metric: "bpd", module: "glance"},
                    "modules", "glance", 50, "File at least 50 blueprints into Glance");

            goalMetric("kpi_container_position", {release: "all", metric: "bpd", module: "glance", start_date: month_ago},
                    "modules", "glance", 20, "File at least 20 blueprints into Glance in last month");

            goalDisagreementRatioLessThan("kpi_container_percentage",
                    {release: "all", metric: "marks", project_type: "all", module: "glance"},
                    "lzy-dev", 0.08, "Disagreement ratio should be less than 8%");


            goalCoreEngineerInProject("kpi_core_status", "lzy-dev", "glance", "Become core engineer in Glance");
        });
    </script>
{% endblock %}


{% block content %}
    <h1>Example of KPI report</h1>

    <h2>Position in top</h2>
    <div id="kpi_container_position"></div>

    <h2>Percentage in top</h2>
    <div id="kpi_container_percentage"></div>

    <h2>Core status</h2>
    <div id="kpi_core_status"></div>
{% endblock %}
