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
Merge requests
!51
name changes: kit -> sample
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
name changes: kit -> sample
81-email-to-technician
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Piotr Gawron
requested to merge
81-email-to-technician
into
master
7 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
#81 (closed)
0
0
Merge request reports
Viewing commit
c679ced9
Show latest version
1 file
+
6
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
c679ced9
name changes: kit -> sample
· c679ced9
Piotr Gawron
authored
7 years ago
smash/web/views/kit.py
+
6
−
5
Options
@@ -82,14 +82,14 @@ def send_mail(data):
end_date_str
=
"
end of time
"
if
data
[
"
end_date
"
]
is
not
None
:
end_date_str
=
data
[
"
end_date
"
].
strftime
(
'
%Y-%m-%d
'
)
title
=
"
Kits required
between
"
+
data
[
"
start_date
"
].
strftime
(
'
%Y-%m-%d
'
)
+
"
and
"
+
end_date_str
title
=
"
Samples
between
"
+
data
[
"
start_date
"
].
strftime
(
'
%Y-%m-%d
'
)
+
"
and
"
+
end_date_str
cell_style
=
"
padding: 8px; line-height: 1.42857143; vertical-align: top;
"
\
"
font-size: 14px; font-family:
'
Source Sans Pro
'
,
'
Helvetica Neue
'
,Helvetica,Arial,sans-serif;
"
email_body
=
"
<h1>
"
+
title
+
"
</h1>
"
email_body
+=
'
<table style=
"
border: 1px solid #f4f4f4;border-spacing: 0;border-collapse: collapse;
"
>
'
\
'
<thead><tr><th>Date</th><th>
Kit
s</th><th>Location</th><th>Person responsible</th></tr></thead>
'
'
<thead><tr><th>Date</th><th>
Sample
s</th><th>Location</th><th>Person responsible</th></tr></thead>
'
email_body
+=
"
<tbody>
"
even
=
True
@@ -106,7 +106,10 @@ def send_mail(data):
if
item
.
disposable
:
email_body
+=
item
.
name
+
"
,
"
email_body
+=
"
</td>
"
email_body
+=
"
<td style=
'"
+
cell_style
+
"'
>
"
+
str
(
appointment
.
location
)
+
"
</td>
"
location
=
str
(
appointment
.
location
)
if
appointment
.
flying_team
is
not
None
:
location
+=
"
(
"
+
str
(
appointment
.
flying_team
)
+
"
)
"
email_body
+=
"
<td style=
'"
+
cell_style
+
"'
>
"
+
location
+
"
</td>
"
email_body
+=
"
<td style=
'"
+
cell_style
+
"'
>
"
+
str
(
appointment
.
worker_assigned
)
+
"
</td>
"
email_body
+=
"
</tr>
"
email_body
+=
"
</tbody></table>
"
@@ -143,8 +146,6 @@ class KitRequestEmailSendJob(CronJobBase):
jobs
=
CronJobLog
.
objects
.
filter
(
code
=
KitRequestEmailSendJob
.
code
,
message
=
"
mail sent
"
,
start_time__gte
=
date
)
if
jobs
.
count
()
==
0
:
print
date
print
datetime
.
datetime
.
now
()
if
pytz
.
utc
.
localize
(
datetime
.
datetime
.
utcnow
())
>
date
:
if
self
.
match_day_of_week
():
data
=
get_kit_requests
(
Worker
.
objects
.
create
());
Loading