Skip to content
Snippets Groups Projects
Commit ecadfb96 authored by Martin Mareš's avatar Martin Mareš Committed by Jan Prachař
Browse files

create-contests: Přeskakuje již existující soutěže

parent f6e9bcea
No related branches found
No related tags found
No related merge requests found
......@@ -48,17 +48,20 @@ else:
assert regions, "Neexistují žádná místa dané úrovně"
for r in regions:
print(f"Zakládám {round.round_code()} pro místo {r.name}")
if not args.dry_run:
c = db.Contest(round=round, place=r, state=state)
sess.add(c)
sess.flush()
c.master = c
mo.util.log(db.LogType.contest, c.contest_id, {
'action': 'created',
})
if sess.query(db.Contest).filter_by(round=round, place=r).first():
print(f"{round.round_code()} pro místo {r.name}: již existuje")
else:
print(f"{round.round_code()} pro místo {r.name}: zakládám")
if not args.dry_run:
c = db.Contest(round=round, place=r, state=state)
sess.add(c)
sess.flush()
c.master = c
mo.util.log(db.LogType.contest, c.contest_id, {
'action': 'created',
})
if not args.dry_run:
sess.commit()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment