Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roll out weekly mail #3222

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions lego/apps/email/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def add_source_to_url(url):


def create_weekly_mail(user):
week_number = timezone.now().isocalendar().week

three_days_ago_timestamp = timezone.now() - timedelta(days=3)
last_sunday_timestamp = timezone.now() - timedelta(days=7)

Expand Down Expand Up @@ -97,6 +99,7 @@ def create_weekly_mail(user):
html_body = render_to_string(
"email/email/weekly_mail.html",
{
"week_number": week_number,
"events": events,
"todays_weekly": ""
if todays_weekly is None
Expand All @@ -117,10 +120,7 @@ def send_weekly_email(self, logger_context=None):
week_number = timezone.now().isocalendar().week

# Set to just PR and Webkom for testing purposes
all_users = set(
AbakusGroup.objects.get(name="Webkom").restricted_lookup()[0]
+ AbakusGroup.objects.get(name="PR").restricted_lookup()[0]
)
all_users = AbakusGroup.objects.get(name="Abakus").restricted_lookup()[0]
recipients = []

for user in all_users:
Expand Down
15 changes: 10 additions & 5 deletions lego/apps/email/templates/email/email/weekly_mail.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{% extends "email/base.html" %}

{% block content %}
<tr>
<td class="content-block">
<h1 style="margin: 20px 0 10px 0;">Ukesmail uke {{week_number}}</h1>
</td>
</tr>
{%if events %}
<tr>
<td class="content-block">
<h3 style="margin: 20px 0 10px 0;">Arrangementer med påmelding neste uke:</h3>
<h3 style="margin: 20px 0 10px 0;">Arrangementer med påmelding neste uke</h3>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -35,7 +40,7 @@ <h4 style="margin: 10px 0 2px 0;">{{event.title}}</h4>
{%if joblistings %}
<tr>
<td class="content-block">
<h3 style="margin: 20px 0 10px 0;" colspan=5>Nye jobbannonser</h3>
<h3 style="margin: 35px 0 10px 0;" colspan=5>Nye jobbannonser</h3>
</td>
</tr>
<tr>
Expand All @@ -49,13 +54,13 @@ <h3 style="margin: 20px 0 10px 0;" colspan=5>Nye jobbannonser</h3>
{% endif %}
{% for joblisting in joblistings%}
<tr>
<td style="text-align: left; padding-right: 10px;">
<td style="padding-top: 5px; text-align: left; padding-right: 10px;">
<a href="https://abakus.no/joblistings/{{joblisting.id}}?utm_source=WeeklyMail&utm_campaign=Email">{{joblisting.title}}</a>
</td>
<td style="text-align: left; padding-right: 10px; min-width: 120px; word-break: break-word;">
<td style="padding-top: 5px; text-align: left; padding-right: 10px; min-width: 140px; word-break: break-word;">
{{joblisting.company_name}}
</td>
<td style="text-align: left; padding-right: 10px; min-width: 120px; word-break: break-word;">
<td style="padding-top: 5px; text-align: left; padding-right: 10px; min-width: 120px; word-break: break-word;">
{{joblisting.type}}
</td>
</tr>
Expand Down