Skip to content
Snippets Groups Projects
Commit b8482740 authored by Martin Mareš's avatar Martin Mareš
Browse files

Import: Jmenovci jsou warning

parent 8c850e50
No related branches found
No related tags found
No related merge requests found
...@@ -563,6 +563,18 @@ class ContestImport(Import): ...@@ -563,6 +563,18 @@ class ContestImport(Import):
self.find_or_create_participation(user, contest, misto) self.find_or_create_participation(user, contest, misto)
# Kontrola na jmenovce
sess = db.get_session()
similar_users = (sess.query(db.User)
.join(db.Participation)
.filter(db.User.first_name == krestni)
.filter(db.User.last_name == prijmeni)
.filter(db.Participation.contest == contest)
.filter(db.User != user)
.all())
if similar_users:
self.warning('Účastník stejného jména a příjmení už na tomto místě soutěží, ověřte prosím, zda to není duplicita')
def get_after_import_message(self) -> str: def get_after_import_message(self) -> str:
return f'Importováno ({self.cnt_rows} řádků, založeno {self.cnt_new_users} uživatelů, {self.cnt_new_participations} účastí, {self.cnt_new_contests} soutěží)' return f'Importováno ({self.cnt_rows} řádků, založeno {self.cnt_new_users} uživatelů, {self.cnt_new_participations} účastí, {self.cnt_new_contests} soutěží)'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment