results.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {% extends "base.html" %}
  2. {% block content %}
  3. <h2>Latency to {{ target }}</h2>
  4. <p>Job submitted at {{ target.submitted.strftime('%Y-%m-%d %H:%M') }}</p>
  5. <table>
  6. <tr>
  7. <th>Latency</th>
  8. <th>Jitter</th>
  9. <th>Packet loss</th>
  10. <th>Source</th>
  11. <th>Comment</th>
  12. <th>Contact</th>
  13. <th>Date</th>
  14. </tr>
  15. {% macro color(packetloss) -%}
  16. {% if packetloss >= 50 %}
  17. "red"
  18. {% elif packetloss > 0 %}
  19. "orange"
  20. {% else %}
  21. "green"
  22. {% endif %}
  23. {%- endmacro %}
  24. {% for r in results %}
  25. {% if r.probes_sent is not none() and r.probes_received is not none() and r.probes_sent != 0 %}
  26. {% set packetloss = (100 * (r.probes_sent - r.probes_received) / r.probes_sent) %}
  27. {% endif %}
  28. <tr>
  29. <td>{% if r.avgrtt is not none() %}{{ r.avgrtt|round(2) }} ms{% endif %}</td>
  30. <td>{% if r.jitter is not none() %}{{ r.jitter|round(2) }} ms{% endif %}</td>
  31. <td>
  32. {% if r.probes_sent is not none() and r.probes_received is not none() and r.probes_sent != 0 %}
  33. <span class={{ color(packetloss) }}>
  34. {{ packetloss|round(2) }}%
  35. </span>
  36. (<span class={{ color(packetloss) }}>{{ r.probes_sent - r.probes_received }}</span>/{{ r.probes_sent }})
  37. {% endif %}
  38. </td>
  39. <td>{{ r.participant.name }}
  40. {% if r.participant.country is not none() %}
  41. ({{ r.participant.country }})
  42. {% endif %}
  43. </td>
  44. <td>{{ r.participant.comment|default("", True) }}</td>
  45. <td>{{ r.participant.contact }}</td>
  46. <td>{{ r.date.strftime('%Y-%m-%d %H:%M') }}</td>
  47. </tr>
  48. {% endfor %}
  49. </table>
  50. {% endblock %}