fix(workflow): test mode emails to maciej.pienczyn@inpi.pl, fix Polish chars
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Email notifications limited to test address during development. Fixed missing Polish characters in notification titles and body. Commented out production email loop (TODO marker for re-enable). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
180a12de27
commit
0a66905b1c
@ -322,11 +322,11 @@ def notify_office_managers(db, meeting, results: dict) -> tuple:
|
||||
meeting_id_str = f"{meeting.meeting_number}/{meeting.year}"
|
||||
action_url = f"/rada/posiedzenia/{meeting.id}/przyjecia"
|
||||
|
||||
title = f"Rada {meeting_id_str} -- nowi czlonkowie"
|
||||
title = f"Rada {meeting_id_str} — nowi członkowie"
|
||||
if needs_attention > 0:
|
||||
message = f"Przyjeto {total} firm. {needs_attention} wymaga uzupelnienia profilu."
|
||||
message = f"Przyjęto {total} firm. {needs_attention} wymaga uzupełnienia profilu."
|
||||
else:
|
||||
message = f"Przyjeto {total} firm. Wszystkie profile sa juz uzupelnione."
|
||||
message = f"Przyjęto {total} firm. Wszystkie profile są już uzupełnione."
|
||||
|
||||
for manager in managers:
|
||||
try:
|
||||
@ -351,9 +351,9 @@ def notify_office_managers(db, meeting, results: dict) -> tuple:
|
||||
# Build HTML table
|
||||
rows = []
|
||||
for m in results.get('matched', []):
|
||||
rows.append(f"<tr><td>{m['matched_name']}</td><td style='color:green;'>Profil istnieje</td></tr>")
|
||||
rows.append(f"<tr><td>{m['matched_name']}</td><td style='color:green;'>✓ Profil istnieje</td></tr>")
|
||||
for c in results.get('created', []):
|
||||
rows.append(f"<tr><td>{c['name']}</td><td style='color:orange;'>Wymaga uzupelnienia</td></tr>")
|
||||
rows.append(f"<tr><td>{c['name']}</td><td style='color:orange;'>⏳ Wymaga uzupełnienia</td></tr>")
|
||||
|
||||
table_html = f"""
|
||||
<table style="width:100%; border-collapse:collapse; margin:16px 0;">
|
||||
@ -364,28 +364,44 @@ def notify_office_managers(db, meeting, results: dict) -> tuple:
|
||||
|
||||
body_html = f"""
|
||||
<p>Na posiedzeniu Rady <strong>{meeting_id_str}</strong> ({meeting.meeting_date.strftime('%d.%m.%Y')})
|
||||
przyjeto <strong>{total}</strong> nowych czlonkow.</p>
|
||||
przyjęto <strong>{total}</strong> nowych członków.</p>
|
||||
{table_html}
|
||||
{'<p><strong>Uwaga:</strong> ' + str(needs_attention) + ' firm wymaga uzupelnienia profilu na portalu.</p>' if needs_attention else ''}
|
||||
<p><a href="https://nordabiznes.pl{action_url}" style="display:inline-block;padding:10px 20px;background:#2563eb;color:white;border-radius:8px;text-decoration:none;font-weight:600;">Przejdz do dashboardu przyjec</a></p>
|
||||
{'<p><strong>Uwaga:</strong> ' + str(needs_attention) + ' firm wymaga uzupełnienia profilu na portalu.</p>' if needs_attention else ''}
|
||||
<p><a href="https://nordabiznes.pl{action_url}" style="display:inline-block;padding:10px 20px;background:#2563eb;color:white;border-radius:8px;text-decoration:none;font-weight:600;">Przejdź do dashboardu przyjęć</a></p>
|
||||
"""
|
||||
|
||||
body_text = f"Na posiedzeniu Rady {meeting_id_str} przyjeto {total} nowych czlonkow. {needs_attention} wymaga uzupelnienia profilu."
|
||||
body_text = f"Na posiedzeniu Rady {meeting_id_str} przyjęto {total} nowych członków. {needs_attention} wymaga uzupełnienia profilu."
|
||||
|
||||
for manager in managers:
|
||||
if manager.email:
|
||||
try:
|
||||
send_email(
|
||||
to=manager.email,
|
||||
subject=f"[NordaBiz] Rada {meeting_id_str} -- przyjeto {total} nowych czlonkow",
|
||||
body_text=body_text,
|
||||
body_html=body_html,
|
||||
email_type='system',
|
||||
recipient_name=manager.name
|
||||
)
|
||||
email_count += 1
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to email {manager.email}: {e}")
|
||||
# TEST MODE: send only to maciej.pienczyn@inpi.pl during testing
|
||||
test_email = 'maciej.pienczyn@inpi.pl'
|
||||
try:
|
||||
send_email(
|
||||
to=test_email,
|
||||
subject=f"[NordaBiz] Rada {meeting_id_str} — przyjęto {total} nowych członków",
|
||||
body_text=body_text,
|
||||
body_html=body_html,
|
||||
email_type='system',
|
||||
recipient_name='Maciej Pienczyn'
|
||||
)
|
||||
email_count = 1
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to send test email: {e}")
|
||||
|
||||
# TODO: Po zakończeniu testów — odkomentować pętlę poniżej i usunąć test_email
|
||||
# for manager in managers:
|
||||
# if manager.email:
|
||||
# try:
|
||||
# send_email(
|
||||
# to=manager.email,
|
||||
# subject=f"[NordaBiz] Rada {meeting_id_str} — przyjęto {total} nowych członków",
|
||||
# body_text=body_text,
|
||||
# body_html=body_html,
|
||||
# email_type='system',
|
||||
# recipient_name=manager.name
|
||||
# )
|
||||
# email_count += 1
|
||||
# except Exception as e:
|
||||
# logger.error(f"Failed to email {manager.email}: {e}")
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to send admission emails: {e}")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user