[mod] /stats : detail per engine

allow to submit a github issue including the technical details
(exceptions, errors, warning, checker result)
This commit is contained in:
Alexandre Flament 2021-04-23 21:08:48 +02:00
parent 0603b043ce
commit df41b77121
7 changed files with 227 additions and 20 deletions

View file

@ -1,18 +1,21 @@
{% extends "oscar/base.html" %}
{% extends 'oscar/base.html' %}
{% from '__common__/new_issue.html' import new_issue %}
{% block title %}{{ _('stats') }} - {% endblock %}
{% block title %}{{ _('stats') }} - {% if selected_engine_name %} {{ selected_engine_name }} - {% endif %}{% endblock %}
{%- macro th_sort(column_order, column_name) -%}
{% if column_order==sort_order %}
{{ column_name }} {{ icon('chevron-down') }}
{% else %}
<a href="{{ url_for('stats', sort=column_order) }}">{{ column_name }}
{% endif %}
{%- if selected_engine_name -%}
{{ column_name }}
{%- elif column_order==sort_order -%}
{{ column_name }} {{ icon('arrow-dropdown') }}
{%- else -%}
<a href="{{ url_for('stats', sort=column_order) }}">{{ column_name }}</a>
{%- endif -%}
{%- endmacro -%}
{% block content %}
<div class="container-fluid">
<h1>{{ _('Engine stats') }}</h1>
<h1>{{ _('Engine stats') }}{% if selected_engine_name %} - {{ selected_engine_name }}{% endif %}</h1>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="table-responsive">
@ -31,14 +34,14 @@
</tr>
{% for engine_stat in engine_stats.get('time', []) %}
<tr>
<td>{{ engine_stat.name }}</td>
<td><a href="{{ url_for('stats', engine=engine_stat.name|e) }}">{{ engine_stat.name }}</a></td>
<td style="text-align: right;">
{% if engine_stat.score %}
{%- if engine_stat.score -%}
<span aria-labelledby="{{engine_stat.name}}_score" >{{ engine_stat.score|round(1) }}</span>
<div class="engine-tooltip text-left" role="tooltip" id="{{engine_stat.name}}_score">{{- "" -}}
<p>{{ _('Scores per result') }}: {{ engine_stat.score_per_result | round(3) }}</p>
</div>
{% endif %}
{%- endif -%}
</td>
<td>
{%- if engine_stat.result_count -%}
@ -92,6 +95,63 @@
{% endif %}
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
{% if selected_engine_name %}
{% for secondary in [False, True] %}
{% set ns = namespace(first=true) %}
{% for error in engine_reliabilities[selected_engine_name].errors %}
{% if secondary == error.secondary %}
{% if ns.first %}
{% set ns.first = false %}
<h3>{% if secondary %}{{ _('Warnings') }}{% else %}{{ _('Errors and exceptions') }}{% endif %}</h3>
{% endif %}
<table class="table table-striped table-bordered">
<tbody style="padding-top: 1rem;">
<tr>
{%- if error.exception_classname -%}
<th scope="row" style="width: 10rem">{{ _('Exception') }}</th><td>{{ error.exception_classname }}</td>
{%- elif error.log_message -%}
<th scope="row" style="width: 10rem">{{ _('Message') }}</th><td>{{ error.log_message }}</td>
{%- endif -%}
<th scope="row" style="width: 10rem">{{ _('Percentage') }}</th><td style="width: 10rem">{{ error.percentage }}</td>
</tr>
{% if error.log_parameters and error.log_parameters != (None, None, None) %}<tr><th scope="row">{{ _('Parameter') }}</th>{{- '' -}}
<td colspan="3">
{%- for param in error.log_parameters -%}
<span style="border-right: 1px solid gray; padding: 0 1rem 0 0; margin: 0 0 0 0.5rem;">{{ param }}</span>
{%- endfor -%}
</td>
</tr>
{% endif %}
<tr><th scope="row">{{ _('Filename') }}</th><td colspan="3">{{ error.filename }}:{{ error.line_no }}</td></tr>
<tr><th scope="row">{{ _('Function') }}</th><td colspan="3">{{ error.function }}</td></tr>
<tr><th scope="row">{{ _('Code') }}</th><td colspan="3">{{ error.code }}</td></tr>
</tbody>
</table>
{% endif %}
{% endfor %}
{% endfor %}
{% if engine_reliabilities[selected_engine_name].checker %}
<h3>{{ _('Checker') }}</h3>
<table class="table table-striped table-bordered">
<tr>
<th scope="col" style="width: 10rem">{{ _('Failed test') }}</th>
<th scope="col">{{ _('Comment(s)') }}</th>
</tr>
{% for test_name, results in engine_reliabilities[selected_engine_name].checker.items() %}
<tr>
<td>{{ test_name }}</td>
<td>
{% for r in results %}<p>{{ r }}</p>{% endfor %}
</td>
</tr>
{% endfor %}
</table>
{% endif %}
{{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
{% endif %}
</div>
</div>
</div>
{% endblock %}