Skip to content

Commit f420701

Browse files
committed
change formatting of CPU time when getting TLE
emphasizes that time limit exceeded means the submission was terminated early. by default this would show the time as "10.035 sec" or similar, which has misled people in the past.
1 parent 1bd6222 commit f420701

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cms/grading/scoretypes/abc.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
from cms import FEEDBACK_LEVEL_RESTRICTED
3838
from cms.db import SubmissionResult
39+
from cms.grading.steps import EVALUATION_MESSAGES
3940
from cms.locale import Translation, DEFAULT_TRANSLATION
4041
from cms.server.jinja2_toolbox import GLOBAL_ENVIRONMENT
4142
from jinja2 import Template
@@ -295,7 +296,9 @@ class ScoreTypeGroup(ScoreTypeAlone):
295296
</td>
296297
{% if feedback_level == FEEDBACK_LEVEL_FULL %}
297298
<td class="execution-time">
298-
{% if "time" in tc and tc["time"] is not none %}
299+
{% if "time_override" in tc and tc["time_override"] is not none %}
300+
&gt; {{ tc["time_override"]|format_duration }}
301+
{% elif "time" in tc and tc["time"] is not none %}
299302
{{ tc["time"]|format_duration }}
300303
{% else %}
301304
{% trans %}N/A{% endtrans %}
@@ -430,11 +433,17 @@ def compute_score(self, submission_result):
430433
tc_outcome = self.get_public_outcome(
431434
tc_score, parameter)
432435

436+
time_override = None
437+
if evaluations[tc_idx].text == [EVALUATION_MESSAGES.get("timeout").message]:
438+
dataset = evaluations[tc_idx].dataset
439+
time_override = dataset.time_limit
440+
433441
testcases.append({
434442
"idx": tc_idx,
435443
"outcome": tc_outcome,
436444
"text": evaluations[tc_idx].text,
437445
"time": evaluations[tc_idx].execution_time,
446+
"time_override": time_override,
438447
"memory": evaluations[tc_idx].execution_memory,
439448
"show_in_restricted_feedback": self.public_testcases[tc_idx],
440449
"show_in_oi_restricted_feedback": self.public_testcases[tc_idx]})

0 commit comments

Comments
 (0)