forked from cms-dev/cms
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make CWS not serve inactive contests in multi-contest mode.
- Loading branch information
Showing
2 changed files
with
5 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
# Copyright © 2015-2016 William Di Luigi <[email protected]> | ||
# Copyright © 2016 Myungwoo Chun <[email protected]> | ||
# Copyright © 2016 Amir Keivan Mohtashami <[email protected]> | ||
# Copyright © 2019 Vytis Banaitis <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
|
@@ -39,7 +40,7 @@ | |
from werkzeug.datastructures import LanguageAccept | ||
from werkzeug.http import parse_accept_header | ||
|
||
from cms.db import Contest | ||
from cms.db import get_active_contest_list | ||
from cms.locale import DEFAULT_TRANSLATION, choose_language_code | ||
from cms.server import CommonRequestHandler | ||
from cmscommon.datetime import utc as utc_tzinfo | ||
|
@@ -167,7 +168,7 @@ def get(self): | |
# We need this to be computed for each request because we want to be | ||
# able to import new contests without having to restart CWS. | ||
contest_list = dict() | ||
for contest in self.sql_session.query(Contest).all(): | ||
for contest in get_active_contest_list(self.sql_session): | ||
contest_list[contest.name] = contest | ||
self.render("contest_list.html", contest_list=contest_list, | ||
**self.r_params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
# Copyright © 2015-2016 William Di Luigi <[email protected]> | ||
# Copyright © 2016 Myungwoo Chun <[email protected]> | ||
# Copyright © 2016 Amir Keivan Mohtashami <[email protected]> | ||
# Copyright © 2019 Vytis Banaitis <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
|
@@ -102,6 +103,7 @@ def choose_contest(self): | |
|
||
# Select the correct contest or return an error | ||
self.contest = self.sql_session.query(Contest)\ | ||
.filter(Contest.active.is_(True))\ | ||
.filter(Contest.name == contest_name).first() | ||
if self.contest is None: | ||
self.contest = Contest( | ||
|