{% extends "base.html" %}

{% block title %}Diff between {{ reference_uuid }} and {{ challenger_uuid }} - Wight v0.1.0{% end %}

{% block contents %}
<div class="diff container">
    <div class="hero-unit">
        <h1>{{ project }} #diff</h1>

        <h3>Diff between:</h3>
        <div class="hero-container">
            <div class="half">
                <p class="lead"><a href="/report/{{ reference_uuid }}">{{ reference_test["config"]["title"] }}</a></p>
                <p><small>{{ reference_test["config"]["description"] }}</small></p>
            </div>
            <div class="half">
                <p class="lead"><a href="/report/{{ challenger_uuid }}">{{ challenger_test["config"]["title"] }}</a></p>
                <p><small>{{ challenger_test["config"]["description"] }}</small></p>
            </div>
        </div>
        <div class="toolbar">
            <div><a href="/diff/{{ reference_uuid }}/{{ challenger_uuid }}"><i class="icon-file"></i>Permalink for this diff</a></div>
            <div><a href="/report/{{ reference_uuid }}"><i class="icon-circle-arrow-left"></i>{{ reference_test["config"]["title"] }} - {{ format_date(reference_run_at) }}</a></div>
            <div><a href="/report/{{ challenger_uuid }}"><i class="icon-circle-arrow-right"></i>{{ challenger_test["config"]["title"] }} - {{ format_date(challenger_run_at) }}</a></div>
            <div><a href="/trend/{{ team }}/{{ project }}/{{ reference_test["config"]["module"] }}/{{ reference_test["config"]["className"] }}/{{ reference_test["config"]["testName"] }}"><i class="icon-fullscreen"></i>Trend for this project</a></div>
        </div>
    </div>

    <div class="row">
        <div class="page-header">
          <h1>Requests <small>details for requests concerning scalability and performance</small></h1>
        </div>

        <h3>Requests per second - Scalability</h3>
        <div class="chart request-rps"><svg></svg></div>
        <div class="chart request-percentage"><svg></svg></div>

        <h3>Requests response time - Velocity</h3>
        <div class="hero-container">
            <div class="half">
                <div class="chart request-average"><svg></svg></div>
                <div class="chart request-average-percentage"><svg></svg></div>
            </div>
            <div class="half">
                <div class="chart request-median"><svg></svg></div>
                <div class="chart request-p90"><svg></svg></div>
                <div class="chart request-max"><svg></svg></div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="page-header">
            <h1>Pages <small>number of pages per second</small></h1>
            <div class="chart page-pps"><svg></svg></div>
        </div>
    </div>

    <p class="text-center"><small>Report generated at {{ report_date }}.</small></p>
</div>
{% end %}

{% block scripts %}
<script>
    var referenceValues = [
        { x: 1, y: 3 },
        { x: 20, y: 30 },
        { x: 40, y: 70 },
        { x: 60, y: 110 },
        { x: 80, y: 125 },
        { x: 100, y: 120 },
        { x: 120, y: 118 },
        { x: 140, y: 125 }
    ];

    var challengerValues = [
        { x: 1, y: 3 },
        { x: 20, y: 28 },
        { x: 40, y: 60 },
        { x: 60, y: 140 },
        { x: 80, y: 180 },
        { x: 100, y: 115 },
        { x: 120, y: 118 },
        { x: 140, y: 115 }
    ];

    var cycles = {{ len(reference_test["cycles"]) }};

    var referenceRequestPerSecondValues = [
        {% for cycle in reference_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["successfulRequestsPerSecond"] }} },
        {% end %}
    ];

    var challengerRequestPerSecondValues = [
        {% for cycle in challenger_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["successfulRequestsPerSecond"] }} },
        {% end %}
    ];


    var referenceResponseTimeAverageValues = [
        {% for cycle in reference_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["average"] }} },
        {% end %}
    ];

    var challengerResponseTimeAverageValues = [
        {% for cycle in challenger_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["average"] }} },
        {% end %}
    ];


    var referenceResponseTimeMedianValues = [
        {% for cycle in reference_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["p50"] }} },
        {% end %}
    ];

    var challengerResponseTimeMedianValues = [
        {% for cycle in challenger_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["p50"] }} },
        {% end %}
    ];


    var referenceResponseTimeP90Values = [
        {% for cycle in reference_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["p90"] }} },
        {% end %}
    ];

    var challengerResponseTimeP90Values = [
        {% for cycle in challenger_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["p90"] }} },
        {% end %}
    ];


    var referenceResponseTimeMaxValues = [
        {% for cycle in reference_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["maximum"] }} },
        {% end %}
    ];

    var challengerResponseTimeMaxValues = [
        {% for cycle in challenger_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["request"]["maximum"] }} },
        {% end %}
    ];


    var referencePagePerSecondsValues = [
        {% for cycle in reference_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["page"]["maximum"] }} },
        {% end %}
    ];

    var challengerPagePerSecondsValues = [
        {% for cycle in challenger_test["cycles"] %}
            { x: {{ cycle["concurrentUsers"] }}, y: {{ cycle["page"]["successfulPagesPerSecond"] }} },
        {% end %}
    ];
</script>
<script src="{{ static_url('js/diff.js') }}"></script>

{% end %}
