-
Notifications
You must be signed in to change notification settings - Fork 405
Expand file tree
/
Copy pathuser_test_row.html
More file actions
executable file
·99 lines (99 loc) · 3.9 KB
/
user_test_row.html
File metadata and controls
executable file
·99 lines (99 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{% set status = tr.get_status() if tr is defined else UserTestResult.COMPILING %}
<tr data-user-test="{{ t_idx }}" data-status="{{ status }}">
{% if show_date %}
<td class="datetime">{{ t.timestamp|format_datetime }}</td>
{% else %}
<td class="time">{{ t.timestamp|format_time }}</td>
{% endif %}
<td class="status">
{% if status == UserTestResult.COMPILING %}
{% trans %}Compiling...{% endtrans %}
{% elif status == UserTestResult.COMPILATION_FAILED %}
{% trans %}Compilation failed{% endtrans %}
<a class="details">{% trans %}details{% endtrans %}</a>
{% elif status == UserTestResult.EVALUATING %}
{% trans %}Executing...{% endtrans %}
{% elif status == UserTestResult.EVALUATED %}
{% trans %}Executed{% endtrans %}
<a class="details">{% trans %}details{% endtrans %}</a>
{% endif %}
</td>
{% if tr is undefined or tr.execution_time is none %}
<td class="execution_time undefined">
{% trans %}N/A{% endtrans %}
</td>
{% else %}
<td class="execution_time">
{{ tr.execution_time|format_duration }}
</td>
{% endif %}
{% if tr is undefined or tr.execution_memory is none %}
<td class="memory undefined">
{% trans %}N/A{% endtrans %}
</td>
{% else %}
<td class="memory">
{{ tr.execution_memory|format_size }}
</td>
{% endif %}
<td class="input">
<a class="btn" href="{{ contest_url("tasks", task.name, "tests", t_idx, "input") }}">
{% trans %}Download{% endtrans %}
</a>
</td>
<td class="output">
{% if status == UserTestResult.COMPILING or status == UserTestResult.EVALUATING %}
<a class="btn btn-primary disabled">
{% trans %}Wait...{% endtrans %}
</a>
{% else %}
{% if tr.output is none %}
<a class="btn btn-primary disabled">
{% trans %}N/A{% endtrans %}
</a>
{% else %}
<a class="btn btn-primary" href="{{ contest_url("tasks", task.name, "tests", t_idx, "output") }}">
{% trans %}Download{% endtrans %}
</a>
{% endif %}
{% endif %}
</td>
<td class="files">
{# We replace '.%l' with the actual language only when it occurs as an extension at the end of the string and only when #}
{# there isn't another file with that name. This allows to securily reverse the replacement and should work great in #}
{# the common case. Yet, it still allows the marginal case of both 'foo.%l' and 'foo.c' in the submission format. #}
{% set files = t.files.keys()|list + t.managers.keys()|list %}
{% if files|length == 0 %}
<a class="btn disabled">
{% trans %}None{% endtrans %}
</a>
{% elif files|length == 1 %}
{% set filename = next(iter(t.files.keys())) %}
{% set real_filename = filename|replace(".%l", (t.language|to_language).source_extension) %}
<a class="btn" href="{{ contest_url("tasks", task.name, "tests", t_idx, "files", real_filename) }}">
{% trans %}Download{% endtrans %}
</a>
{% else %}
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown">
{% trans %}Download{% endtrans %}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% for filename in files %}
{% if t.language is not none %}
{% set real_filename = filename|replace(".%l", (t.language|to_language).source_extension) %}
{% else %}
{% set real_filename = filename %}
{% endif %}
<li>
<a href="{{ contest_url("tasks", task.name, "tests", t_idx, "files", real_filename) }}">
{{ real_filename }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</td>
</tr>