Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
elixir
daisy
Commits
f59b384d
Commit
f59b384d
authored
Sep 16, 2021
by
Jacek Lebioda
Browse files
feat: corrections in template and send email functions
parent
d1e82780
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
core/templates/report_email.html
core/templates/report_email.html
+3
-3
core/templates/report_email.txt
core/templates/report_email.txt
+3
-3
notification/tasks.py
notification/tasks.py
+6
-4
No files found.
core/templates/report_email.html
View file @
f59b384d
...
...
@@ -46,7 +46,7 @@
Projects count: {{ projects | length }}
<br
/>
Datasets count: {{ datasets | length }}
<br
/>
Data declarations count: {{ data_declarations | length }}
<br
/><br
/>
Issues found: {{ issues | length }}
{% if issues %}
Issues found: {{ issues | length }}
{% else %}No issues with the entries found{% endif %}
</td>
<td
width=
"5%"
style=
"background-color: #fff"
></td>
</tr>
...
...
@@ -108,7 +108,7 @@
</table>
{% endfor %}
{% if issues %}
<table
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
style=
"table-layout: fixed;font-family: 'Roboto','Helvetica','Arial',sans-serif;
font-weight: 300; background-color: rgba(158, 158, 158, 0.2);"
...
...
@@ -142,5 +142,5 @@
</tr>
{% endfor %}
<tr
style=
"background-color: #ffffff; height: 60px; width: 100%"
><td
colspan=
4
></td></tr>
</table>
</table>
{% endif %}
</div>
core/templates/report_email.txt
View file @
f59b384d
...
...
@@ -9,7 +9,7 @@ General overview:
Projects count: {{ projects | length }}
Datasets count: {{ datasets | length }}
Data declarations count: {{ data_declarations | length }}
Issues found: {{ issues | length }}
{% if issues %}
Issues found: {{ issues | length }}
{% else %}No issues with the entries found{% endif %}
Detailed overview:
{% for project in projects.all %}
...
...
@@ -24,10 +24,10 @@ Detailed overview:
{% endfor %}
Issues found:
{% if issues %}
Issues found:
{% for issue in issues %}
{{ issue.code }}: {{ issue.description }}
{{ issue.object_title }}
{{ issue.url }}
{% endfor %}
{% endfor %}
{% endif %}
\ No newline at end of file
notification/tasks.py
View file @
f59b384d
import
datetime
from
collections
import
defaultdict
from
datetime
import
timedelta
from
celery
import
shared_task
from
django.conf
import
settings
from
django.utils
import
timezone
from
django.db.models
import
Q
from
django.utils
import
timezone
from
core.models
import
Contract
,
DataDeclaration
,
Dataset
,
Document
,
Project
,
User
from
notification.email_sender
import
send_
the_
email
from
notification.email_sender
import
send_email
_from_template
from
notification.models
import
(
Notification
,
NotificationStyle
,
NotificationVerb
)
# map each notification style to a delta
...
...
@@ -44,7 +46,7 @@ def send_notifications_for_user_by_time(user_id, time):
'user'
:
user
,
'notifications'
:
dict
(
notifications_by_verb
)
}
send_
the_
email
(
send_email
_from_template
(
settings
.
EMAIL_DONOTREPLY
,
user
.
email
,
'Notifications'
,
...
...
@@ -65,7 +67,7 @@ def send_dataset_notification_for_user(user_id, dataset_id, created):
'dataset'
:
dataset
,
'created'
:
created
}
send_
the_
email
(
send_email
_from_template
(
settings
.
EMAIL_DONOTREPLY
,
user
.
email
,
'Notifications'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment