diff --git a/etc/config.py.example b/etc/config.py.example index 9b9e4ec05976ee108f147230b9bcea884241682c..72c464072e6127528eecf1a2a7af3773891d90e5 100644 --- a/etc/config.py.example +++ b/etc/config.py.example @@ -47,7 +47,3 @@ JOB_GC_PERIOD = 60 # Za jak dlouho expiruje dokončená dávka [min] JOB_EXPIRATION = 5 - -# Automatické přihlašování účastníků do testovací soutěže -# (kolo aktuální_ročník-T-1, celostátní soutěž) -AUTO_REGISTER_TEST = False diff --git a/mo/web/user.py b/mo/web/user.py index 9d5c2df8165c2e152e59c72f43a97f44e15ce242..fa8fb961fd860324870fed854b6474b3f3780708 100644 --- a/mo/web/user.py +++ b/mo/web/user.py @@ -21,9 +21,6 @@ import mo.web.util @app.route('/user/') def user_index(): pcrs = load_pcrs() - if getattr(config, 'AUTO_REGISTER_TEST', False) and not any(round.category == 'T' for pion, contest, round in pcrs): - if register_to_test(): - pcrs = load_pcrs() return render_template( 'user_index.html', @@ -43,36 +40,6 @@ def load_pcrs() -> List[Tuple[db.Participation, db.Contest, db.Round]]: .all()) -def register_to_test() -> bool: - sess = db.get_session() - round = sess.query(db.Round).filter_by(year=mo.current_year, category='T', seq=1, part=0).one_or_none() - if not round: - app.logger.error(f'Nemohu najít kolo {mo.current_year}-T-1') - return False - - if round.level != 0: - app.logger.error(f'Kolo {round.round_code_short()} není na celostátní úrovni') - return False - - contest = sess.query(db.Contest).filter_by(round=round).limit(1).one_or_none() - if not contest: - app.logger.error(f'Kolo {round.round_code_short()} nemá soutěž') - return False - - pion = db.Participation(user=g.user, contest=contest, place=contest.place, state=db.PartState.registered) - sess.add(pion) - sess.flush() - mo.util.log( - type=db.LogType.participant, - what=g.user.user_id, - details={'action': 'add-to-contest', 'new': db.row2dict(pion)}, - ) - sess.commit() - - app.logger.info(f'Účastník #{g.user.user_id} automaticky registrován do soutěže #{contest.contest_id}') - return True - - def get_contest(id: int) -> db.Contest: contest = (db.get_session().query(db.Contest) .options(joinedload(db.Contest.place),