Skip to content
Snippets Groups Projects

Draft: Dělená kola

1 file
+ 5
1
Compare changes
  • Side-by-side
  • Inline
@@ -280,6 +280,10 @@ def contest_breadcrumbs(
round_id = None
if round:
round_id = round.round_id
if round.is_subround():
elements.append((url_for('org_round', id=round.master_round_id), round.round_code()))
elements.append((url_for('org_round', id=round_id), f'Podkolo {round.name}'))
else:
elements.append((url_for('org_round', id=round_id), round.round_code()))
ct_id = None
if contest:
@@ -342,7 +346,7 @@ def org_contest(id: int, site_id: Optional[int] = None):
sess.query(db.Place, func.count('*'))
.select_from(db.Participation).join(db.Place)
.group_by(db.Place)
.filter(db.Participation.contest_id == id).all()
.filter(db.Participation.contest_id == contest.master_contest_id).all()
)
return render_template(
@@ -412,6 +416,11 @@ def doc_import():
@app.route('/org/contest/c/<int:id>/import', methods=('GET', 'POST'))
def org_contest_import(id: int):
contest, rr = get_contest_rr(id, Right.manage_contest)
if contest.is_subcontest():
# Podsoutěže nemají účastníky a nepodporují import
raise werkzeug.exceptions.NotFound
return generic_import(contest.round, contest)
@@ -419,6 +428,11 @@ def org_contest_import(id: int):
@app.route('/org/contest/c/<int:id>/site/<int:site_id>/ucastnici', methods=('GET', 'POST'))
def org_contest_list(id: int, site_id: Optional[int] = None):
contest, site, rr = get_contest_site_rr(id, site_id)
if contest.is_subcontest():
# Podsoutěže nemají účastníky
raise werkzeug.exceptions.NotFound
can_edit = rr.have_right(Right.manage_contest)
format = request.args.get('format', "")
@@ -1388,6 +1402,10 @@ def org_contest_advance(contest_id: int):
conn = sess.connection()
contest, rr = get_contest_rr(contest_id, Right.manage_contest)
if contest.is_subcontest():
# Podsoutěže nemají účastníky a nepodporují postoupení
raise werkzeug.exceptions.NotFound
def redirect_back():
return redirect(url_for('org_contest', id=contest_id))
@@ -1396,7 +1414,12 @@ def org_contest_advance(contest_id: int):
flash('Aktuální kolo není ve stavu přípravy', 'danger')
return redirect_back()
prev_round = sess.query(db.Round).filter_by(year=round.year, category=round.category, seq=round.seq - 1).one_or_none()
prev_round = sess.query(db.Round).filter_by(
year=round.year, category=round.category, seq=round.seq - 1
).filter(
# Podmínka kvůli podkolům
db.Round.master_round_id == db.Round.round_id
).one_or_none()
if prev_round is None:
flash('Předchozí kolo nenalezeno', 'danger')
return redirect_back()
Loading