HBASE-18044 Fix bug in report-flakies.py where if counter is set outside for loop, it cannot be overwritten inside loop.

http://stackoverflow.com/questions/7537439/how-to-increment-a-variable-on-a-for-loop-in-jinja-template

Change-Id: Ic404d6360fb646e6490d1487374520f9550b76b4
This commit is contained in:
Apekshit Sharma 2017-05-12 02:25:19 -07:00
parent 341223d86c
commit 841bb00655
1 changed files with 4 additions and 7 deletions

View File

@ -55,22 +55,19 @@
<br><br> <br><br>
<span style="font-size:20px;"><b>List of Jobs</b></span><br> <span style="font-size:20px;"><b>List of Jobs</b></span><br>
<br> <br>
{% set counter = 0 %}
{% for url in results %} {% for url in results %}
{% set counter = counter + 1 %} <a href="#job_{{ loop.index }}">{{ url |e }}</a>
<a href="#job_{{ counter }}">{{ url |e }}</a>
<br> <br>
{% endfor %} {% endfor %}
<br> <br>
<br> <br>
<span style="font-size:20px;"><b>Results</b></span><br> <span style="font-size:20px;"><b>Results</b></span><br>
<br> <br>
{% set counter = 0 %}
{% for url in results %} {% for url in results %}
{% set result = results[url] %} {% set result = results[url] %}
{% set url_counter = loop.index %}
{# Dedup ids since test names may duplicate across urls #} {# Dedup ids since test names may duplicate across urls #}
{% set counter = counter + 1 %} <span id="job_{{ url_counter }}" style="font-weight:bold;">
<span id="job_{{ counter }}" style="font-weight:bold;">
{{ url |e }}<br> {{ url |e }}<br>
<a href="{{ url |e }}"> <a href="{{ url |e }}">
Go to <img height="16px" src="https://jenkins.io/sites/default/files/jenkins_favicon.ico"> Go to <img height="16px" src="https://jenkins.io/sites/default/files/jenkins_favicon.ico">
@ -108,7 +105,7 @@
{{ failed|length }} / {{ timeout|length }} / {{ hanging|length }} {{ failed|length }} / {{ timeout|length }} / {{ hanging|length }}
</td> </td>
<td> <td>
{% set id = "details_" ~ test ~ "_" ~ counter %} {% set id = "details_" ~ test ~ "_" ~ url_counter %}
<button class="show_hide_button" onclick="toggle('{{ id }}')"> <button class="show_hide_button" onclick="toggle('{{ id }}')">
show/hide</button> show/hide</button>
<br/> <br/>