Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
a4109032
Commit
a4109032
authored
4 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
90s table format for covid stats mail
parent
a20cbab4
No related branches found
No related tags found
1 merge request
!248
90s table format for covid stats mail
Pipeline
#25500
passed
4 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/views/virus_mail.py
+35
-4
35 additions, 4 deletions
smash/web/views/virus_mail.py
with
35 additions
and
4 deletions
smash/web/views/virus_mail.py
+
35
−
4
View file @
a4109032
...
@@ -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 s
tatistics
"
title
=
"
SARS-COV2 Virus RT-PCR Assay S
tatistics
"
email_body
=
create_statistic_email_content
(
data
,
title
)
email_body
=
create_statistic_email_content
(
data
,
title
)
recipients
=
[]
recipients
=
[]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment