Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cms/grading/scoretypes/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class ScoreTypeGroup(ScoreTypeAlone):
{% endif %}
<div class="subtask-head">
<span class="title">
{% trans index=st["idx"] %}Subtask {{ index }}{% endtrans %}
{% trans name=st["name"] %}{{ name }}{% endtrans %}
</span>
{% if "score" in st and "max_score" in st %}
<span class="score">
Expand Down Expand Up @@ -473,6 +473,10 @@ def compute_score(self, submission_result):
tc["show_in_oi_restricted_feedback"] = (
tc["idx"] == tc_first_lowest_idx)

if st_score_fraction < 1.0 and parameter[0] > 0: # display full feedback for sample cases
for t in testcases:
t["show_in_restricted_feedback"] = (t["idx"] <= restricted_feedback_idx)

score += st_score
subtasks.append({
"idx": st_idx,
Expand All @@ -483,6 +487,7 @@ def compute_score(self, submission_result):
# But we also want the properly rounded score for display.
"score": rounded_score,
"max_score": parameter[0],
"name": parameter[2],
"testcases": testcases})
if all(self.public_testcases[tc_idx] for tc_idx in target):
public_score += st_score
Expand Down
9 changes: 6 additions & 3 deletions cms/server/admin/templates/macro/reevaluation_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
{% endfor %}
'level': 'compilation'},
function(response) { utils.redirect_if_ok('{{ next_page }}', response); }
);"
);
}"
{% if not allowed %}
disabled
{% endif %}
Expand All @@ -56,7 +57,8 @@
{% endfor %}
'level': 'evaluation'},
function(response) { utils.redirect_if_ok('{{ next_page }}', response); }
);"
);
}"
{% if not allowed %}
disabled
{% endif %}
Expand All @@ -69,7 +71,8 @@
{% endfor %}
},
function(response) { utils.redirect_if_ok('{{ next_page }}', response); }
);"
);
}"
{% if not allowed %}
disabled
{% endif %}
Expand Down
10 changes: 8 additions & 2 deletions cms/server/contest/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import logging
import traceback
from datetime import datetime, timedelta

import collections

Expand Down Expand Up @@ -202,7 +203,12 @@ def get(self):
# able to import new contests without having to restart CWS.
contest_list = dict()
for contest in self.sql_session.query(Contest).all():
contest: Contest
contest_list[contest.name] = contest
# We hide contests that ended more than a week ago, or start more than a week from now
today = datetime.now()
seven_days_ago = today - timedelta(days=7)
seven_days_ahead = today + timedelta(days=7)
if contest.start < seven_days_ahead and contest.stop > seven_days_ago:
contest_list[contest.name] = contest

self.render("contest_list.html", contest_list=contest_list,
**self.r_params)
37 changes: 24 additions & 13 deletions cms/server/contest/phase_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,20 @@ def compute_actual_phase(
actual_start = None
actual_stop = None

if contest_start <= timestamp <= contest_stop:
adjusted_start = contest_start + delay_time
adjusted_stop = contest_stop + delay_time + extra_time

if adjusted_start <= timestamp <= adjusted_stop:
actual_phase = -1
current_phase_begin = contest_start
current_phase_end = contest_stop
elif timestamp < contest_start:
current_phase_begin = adjusted_start
current_phase_end = adjusted_stop
elif timestamp < adjusted_start:
actual_phase = -2
current_phase_begin = None
current_phase_end = contest_start
elif contest_stop < timestamp:
current_phase_end = adjusted_start
elif adjusted_stop < timestamp:
actual_phase = +2
current_phase_begin = contest_stop
current_phase_begin = adjusted_stop
current_phase_end = None
else:
raise RuntimeError("Logic doesn't seem to be working...")
Expand All @@ -130,18 +133,26 @@ def compute_actual_phase(
# "Traditional" contest.
intended_start = contest_start
intended_stop = contest_stop

# delay time shifts the window, extra time shifts just the endpoint
actual_start = intended_start + delay_time
actual_stop = intended_stop + delay_time + extra_time
else:
# "USACO-like" contest, and we already know when the user
# started/will start.
# Both values are lower- and upper-bounded to prevent the
# ridiculous situations of starting_time being set by the
# admin way before contest_start or after contest_stop.
intended_start = min(max(starting_time,
contest_start), contest_stop)
intended_stop = min(max(starting_time + per_user_time,
contest_start), contest_stop)
actual_start = intended_start + delay_time
actual_stop = intended_stop + delay_time + extra_time

# delay time shifts the contest_start / contest_end, but it doesn't shift the starting_time (i.e. the time that they press the button)
intended_start = min(max(starting_time, contest_start + delay_time),
contest_stop + delay_time)
intended_stop = min(max(starting_time + per_user_time, contest_start + delay_time),
contest_stop + delay_time)

actual_start = intended_start
actual_stop = intended_stop + extra_time


assert contest_start <= actual_start <= actual_stop

Expand Down
4 changes: 2 additions & 2 deletions cms/server/contest/submission/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def accept_submission(
logger.info(f'Submission rejected: {err}')
raise UnacceptableSubmission(
N_("Invalid submission format!"),
N_("Please select the correct files."))
N_("Please select the correct file and ensure that it has the correct file extension. For example, in C++, you should submit a .cpp file."))

digests: dict[str, str] = dict()
missing_codenames = required_codenames.difference(files.keys())
Expand All @@ -218,7 +218,7 @@ def accept_submission(
else:
raise UnacceptableSubmission(
N_("Invalid submission format!"),
N_("Please select the correct files."))
N_("Please select the correct file and ensure that it has the correct file extension. For example, in C++, you should submit a .cpp file."))

if any(
len(content) > config.contest_web_server.max_submission_length
Expand Down
2 changes: 2 additions & 0 deletions cmscontrib/loaders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .italy_yaml import YamlLoader
from .polygon import PolygonTaskLoader, PolygonUserLoader, PolygonContestLoader
from .tps import TpsTaskLoader
from .ctf import CtfTaskLoader


LOADERS: dict[str, type[BaseLoader]] = dict(
Expand All @@ -32,6 +33,7 @@
PolygonUserLoader,
PolygonContestLoader,
TpsTaskLoader,
CtfTaskLoader
]
)

Expand Down
Loading
Loading