Skip to content
Snippets Groups Projects
Commit d4235d65 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'stats_mail' into 'master'

90s table format for covid stats mail

See merge request NCER-PD/scheduling-system!248
parents 4267848a a4109032
No related branches found
No related tags found
1 merge request!24890s table format for covid stats mail
Pipeline #25641 passed
......@@ -55,18 +55,49 @@ def get_subject_statistics():
def create_statistic_email_content(data, title):
email_body = "<h1>" + title + "</h1>"
email_body = u"<h1>" + title + "</h1>"
email_body += u'<b>Date: {}</b>'.format(datetime.datetime.now().strftime('%d.%m.%Y')) + "</br></br>"
email_body += u"In the past 24 hours " + str(data["total"]) + " donors were tested</br></br>"
email_body += """
<table style="border: 1px solid black; border-collapse: collapse;">
<tr style="border: 1px solid black;">
<th style="border: 1px solid black;">SARS-COV2 Virus</th>
<th style="border: 1px solid black;">Number of Donors</th>
</tr>
"""
email_body += "In the past 24 hours " + str(data["total"]) + " donors were tested</br></br>"
for status in data:
if status != "total":
email_body += str(data[status]) + ' number of donors were tested ' + status + "</br>"
email_body += """
<tr style="border: 1px solid black;">
<td style="border: 1px solid black;">{}</td>
<td style="border: 1px solid black; text-align: right;">{}</td>
</tr>
""".format(status, data[status])
email_body += """
<tr style="border: 1px solid black;">
<td style="border: 1px solid black;">{}</td>
<td style="border: 1px solid black; text-align: right;">{}</td>
</tr>
""".format('Total', data["total"])
email_body += "</table>"
#SARS-COV2 Virus | Number of Donors
#Inconclusive | 5
#Positive | 15
#Negative | 45
#Total | 65
return email_body
def send_mail(data):
title = "Virus test statistics"
title = "SARS-COV2 Virus RT-PCR Assay Statistics"
email_body = create_statistic_email_content(data, title)
recipients = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment