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

V e-mailových notifikacích uvádíme i URL seznamu účastníků

parent 231a962a
Branches
No related tags found
1 merge request!86Registrace
......@@ -73,6 +73,13 @@ def confirm_url(type: str, token: str) -> str:
return config.WEB_ROOT + f'auth/confirm/{type}?' + urllib.parse.urlencode({'token': token}, safe=':')
def contestant_list_url(contest: db.Contest, registered_only: bool) -> str:
url = config.WEB_ROOT + f'org/contest/c/{contest.contest_id}/ucastnici'
if registered_only:
url += '?participation_state=registered'
return url
def send_new_account_email(user: db.User, token: str) -> bool:
return send_user_email(user, 'Založen nový účet', textwrap.dedent('''\
Vítejte!
......@@ -127,8 +134,10 @@ def send_join_notify_email(dest: db.User, who: db.User, contest: db.Contest) ->
place = contest.place
if contest.round.enroll_mode == db.RoundEnrollMode.confirm:
confirm = 'Přihlášku je potřeba potvrdit v seznamu účastníků soutěže.'
url = 'Přihlášky k potvrzení: ' + contestant_list_url(contest, True)
else:
confirm = 'Přihláška byla schválena automaticky.'
url = 'Seznam účastníků: ' + contestant_list_url(contest, False)
return send_user_email(dest, f'Nový účastník kategorie {round.category}', textwrap.dedent(f'''\
Nový účastník se přihlásil do MO v oblasti, kterou garantujete.
......@@ -141,5 +150,7 @@ def send_join_notify_email(dest: db.User, who: db.User, contest: db.Contest) ->
{confirm}
{url}
Váš OSMO
'''))
......@@ -442,6 +442,7 @@ def org_contest_import(id: int):
)
# URL je explicitně uvedeno v mo.email.contestant_list_url
@app.route('/org/contest/c/<int:id>/ucastnici', methods=('GET', 'POST'))
@app.route('/org/contest/c/<int:id>/site/<int:site_id>/ucastnici', methods=('GET', 'POST'))
@app.route('/org/contest/c/<int:id>/ucastnici/emails', endpoint="org_contest_list_emails")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment