Skip to content

Commit

Permalink
hide old/upcoming contests
Browse files Browse the repository at this point in the history
  • Loading branch information
AngusRitossa committed Jul 12, 2024
1 parent 738fca3 commit 00ce5ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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

try:
import tornado4.web as tornado_web
Expand Down Expand Up @@ -168,6 +169,11 @@ 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_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)

0 comments on commit 00ce5ed

Please sign in to comment.