Skip to content
Snippets Groups Projects
Commit a4109032 authored by Carlos Vega's avatar Carlos Vega
Browse files

90s table format for covid stats mail

parent a20cbab4
No related branches found
No related tags found
1 merge request!24890s table format for covid stats mail
Pipeline #25500 passed
...@@ -55,18 +55,49 @@ def get_subject_statistics(): ...@@ -55,18 +55,49 @@ def get_subject_statistics():
def create_statistic_email_content(data, title): 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: for status in data:
if status != "total": 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 return email_body
def send_mail(data): def send_mail(data):
title = "Virus test statistics" title = "SARS-COV2 Virus RT-PCR Assay Statistics"
email_body = create_statistic_email_content(data, title) email_body = create_statistic_email_content(data, title)
recipients = [] 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