mirror of
https://github.com/sartography/uva-covid19-testing-communicator.git
synced 2025-02-23 12:28:26 +00:00
Added email vaildation
This commit is contained in:
parent
5baca8fa3f
commit
5a64a1d205
@ -193,10 +193,14 @@ def _notify_by_email(file_name=None, retry=False):
|
||||
if last_failure and not retry:
|
||||
continue
|
||||
try:
|
||||
assert (sample.email != None)
|
||||
notifier.send_result_email(sample)
|
||||
count += 1
|
||||
sample.email_notified = True
|
||||
db.session.add(Notification(type=EMAIL_TYPE, sample=sample, successful=True))
|
||||
except AssertionError as e:
|
||||
app.logger.error(f'Email not provided for Sample: {sample.barcode} ', exc_info=True)
|
||||
continue
|
||||
except smtplib.SMTPServerDisconnected as de:
|
||||
app.logger.error("Database connection terminated, stopping for now.", exc_info=True)
|
||||
break
|
||||
|
@ -145,6 +145,8 @@ def get_topbar_data(last_modified = None, start_date = None, end_date = None, st
|
||||
response[4] = notifications.filter(Notification.successful == "f").filter(Notification.type == "email").count()
|
||||
response[5] = notifications.filter(Notification.successful == "t").filter(Notification.type == "text").count()
|
||||
response[6] = notifications.filter(Notification.successful == "f").filter(Notification.type == "text").count()
|
||||
|
||||
response[7] = 9
|
||||
return response
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user