Skip to content
Snippets Groups Projects

WIP: Reforma importů

Closed
Martin Marešrequested to merge
mj/import into master
1 open thread
1 file
+ 7
4
Compare changes
  • Side-by-side
  • Inline
@@ -288,11 +288,14 @@ def generic_import(round: db.Round, contest: Optional[db.Contest]):
@@ -288,11 +288,14 @@ def generic_import(round: db.Round, contest: Optional[db.Contest]):
form.file.data.save(tmp_path)
form.file.data.save(tmp_path)
if imp.run(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 imp.cnt_rows == 0:
if contest is not None:
flash('Soubor neobsahoval žádné řádky s daty', 'danger')
return redirect(url_for('org_contest', id=contest.contest_id))
else:
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:
else:
flash('Došlo k chybě při importu (detaily níže)', 'danger')
flash('Došlo k chybě při importu (detaily níže)', 'danger')
errs = imp.errors
errs = imp.errors
Loading