This commit is contained in:
Egor Matveev 2022-02-25 17:49:34 +03:00
parent 158a007b37
commit f1eb129b68
2 changed files with 12 additions and 6 deletions

View File

@ -121,7 +121,11 @@ class BaseTester:
).text.strip().replace('\r\n', '\n') ).text.strip().replace('\r\n', '\n')
print('predicted:', self.predicted) print('predicted:', self.predicted)
self.solution.test = int(test.filename) self.solution.test = int(test.filename)
self.solution.extras[test.filename] = {'predicted': test.text, 'output': ''} try:
predicted = self.predicted.decode('utf-8')
except UnicodeDecodeError:
predicted = ''
self.solution.extras[test.filename] = {'predicted': predicted, 'output': ''}
self.solution.save() self.solution.save()
try: try:
self.test(test.filename) self.test(test.filename)

View File

@ -43,24 +43,26 @@
{% for entity in solution.files %} {% for entity in solution.files %}
<h5>{{ entity.filename }}</h5> <h5>{{ entity.filename }}</h5>
<pre><code class="{{ entity.highlight }}" style="border: 1px solid black;">{{ entity.text }}</code></pre> <pre><code class="{{ entity.highlight }}" style="border: 1px solid black;">{{ entity.text }}</code></pre>
<hr> <hr><hr>
{% endfor %} {% endfor %}
{% if solution.task.creator == user or user.username in solution.task.editors or solution.set and solution.set.creator == user or solution.set and user.username in solution.set.editors %} {% if solution.task.creator == user or user.username in solution.task.editors or solution.set and solution.set.creator == user or solution.set and user.username in solution.set.editors %}
<h4>Лог тестрования</h4> <h4>Лог тестрования</h4>
{% for key, value in solution.extras.items %} {% for key, value in solution.extras.items %}
<h5>{{ key }}</h5> <h5>Тест {{ key }}</h5>
Затраченное время: {{ value.time_spent }} мс Затраченное время: {{ value.time_spent }} мс
<div class="row"> <div class="row">
<div class="col-2"></div> <div class="col-4" style="background-color: #DDDDDD;">
<div class="col-2" style="background-color: #DDDDDD;"> Ожидаемый вывод:<br>
{{ value.predicted }} {{ value.predicted }}
</div> </div>
<div class="col-4"></div> <div class="col-4"></div>
<div class="col-2" style="background-color: #DDDDDD;"> <div class="col-4" style="background-color: #DDDDDD;">
Фактический вывод:<br>
{{ value.output }} {{ value.output }}
</div> </div>
</div> </div>
<hr>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}