Skip to content
Snippets Groups Projects

WIP: Reforma importů

Files

@@ -288,11 +288,14 @@ def generic_import(round: db.Round, contest: Optional[db.Contest]):
form.file.data.save(tmp_path)
if imp.run(tmp_path):
flash(f'Importováno({imp.cnt_rows} řádků, založeno {imp.cnt_new_users} uživatelů, {imp.cnt_new_participations} účastí)', 'success')
if contest is not None:
return redirect(url_for('org_contest', id=contest.contest_id))
if imp.cnt_rows == 0:
flash('Soubor neobsahoval žádné řádky s daty', 'danger')
else:
return redirect(url_for('org_round', id=round.round_id))
flash(f'Importováno ({imp.cnt_rows} řádků, založeno {imp.cnt_new_users} uživatelů, {imp.cnt_new_participations} účastí)', 'success')
if contest is not None:
return redirect(url_for('org_contest', id=contest.contest_id))
else:
return redirect(url_for('org_round', id=round.round_id))
else:
flash('Došlo k chybě při importu (detaily níže)', 'danger')
errs = imp.errors
Loading