Skip to content

Commit

Permalink
Merge dashboard-email views into one place
Browse files Browse the repository at this point in the history
This is a giant refactoring I've been wanting to do for a while, to keep
the various email reminders from needing to be defined in multiple
places.

I'm pretty sure I fixed some bugs along the way, but I wasn't
disciplined about making small commits, so I'm not real sure what they
were...
  • Loading branch information
jameysharp committed Mar 29, 2019
1 parent 66c2f13 commit c9fa417
Show file tree
Hide file tree
Showing 28 changed files with 416 additions and 341 deletions.
434 changes: 396 additions & 38 deletions home/dashboard.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion home/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def message_samples():
contributor_deadline_reminder(contributor, current_round, request)
contributor_application_period_ended(contributor, current_round, request)
notify_accepted_intern(intern_selection, request)
for week in ('one', 'three', 'five'):
for week in (1, 3, 5, 7):
template = 'home/email/internship-week-{}.txt'.format(week)
biweekly_internship_email(intern_selection, request, template)
initial_feedback_email(intern_selection, request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>After the first application period deadline. Send the email on {{ due }} after 4pm UTC.</li>
</ul>
</p>

<p><a href="{% url 'email-application-period-ended' round_slug=current_round.slug %}" class="btn btn-success">Contributor Final Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email on {{ due }} at 4pm UTC.</li>
</ul>
</p>

<p><a href="{% url 'email-contributor-deadline-reminder' round_slug=current_round.slug %}" class="btn btn-success">Contributor Deadline Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>After the first application period deadline. Send the email on {{ due }} after 4pm UTC.</li>
</ul>
</p>

<p><a href="{% url 'email-coordinator-intern-selection-reminder' round_slug=current_round.slug %}" class="btn btn-success">Coordinator Intern Selection Email</a></p>
2 changes: 0 additions & 2 deletions home/templates/home/dashboard/email/deadline-reminder.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
<p>Once mentors have had a couple days to mark their project as closed, late, or needs promotion,
you can send an email to the announcements mailing list to remind applicants of the upcoming deadlines:</p>

<p><a href="{% url 'email-deadline-reminder' round_slug=current_round.slug %}" class="btn btn-success">Applicant Deadline Email</a></p>
2 changes: 0 additions & 2 deletions home/templates/home/dashboard/email/deadline-review.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<p>Two weeks before the application deadline, project mentors are either overloaded with applicants,
or don't have enough applicants. Send a reminder email to either close their project to new applicants,
or extend their project deadline by a week (and/or mark their project as needing more applicants).</p>

<p><a href="{% url 'email-deadline-review' round_slug=current_round.slug %}" class="btn btn-success">Mentor Deadlines Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email after {{ due }}.</li>
</ul>
</p>

<p><a href="{% url 'email-final-feedback-instructions' round_slug=current_round.slug %}" class="btn btn-success">Final Feedback Reminder</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email after {{ due }}.</li>
</ul>
</p>

<p><a href="{% url 'email-initial-feedback-instructions' round_slug=current_round.slug %}" class="btn btn-success">Initial Feedback Reminder</a></p>
2 changes: 0 additions & 2 deletions home/templates/home/dashboard/email/intern-welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>After the interns are announced. Send the email on {{ due }} after 4pm UTC.</li>
</ul>
</p>

<p><a href="{% url 'email-intern-welcome' round_slug=current_round.slug %}" class="btn btn-success">Intern Welcome Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email on {{ due }}.</li>
</ul>
</p>

<p><a href="{% url 'email-internship-week' round_slug=current_round.slug week='one' %}" class="btn btn-success">Week 1 Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email after {{ due }}.</li>
</ul>
</p>

<p><a href="{% url 'email-internship-week' round_slug=current_round.slug week='three' %}" class="btn btn-success">Week 3 Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email after {{ due }}.</li>
</ul>
</p>

<p><a href="{% url 'email-internship-week' round_slug=current_round.slug week='five' %}" class="btn btn-success">Week 5 Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email after {{ due }}.</li>
</ul>
</p>

<p><a href="{% url 'email-internship-week' round_slug=current_round.slug week='seven' %}" class="btn btn-success">Week 7 Email</a></p>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>You'll need to send a reminder email to mentors who have an approved project to let them know about the application deadline, and to give them instructions on how to help applicants complete the timeline.</p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>After the first application period deadline. Send the email on {{ due }} after 4pm UTC.</li>
</ul>
</p>

<p><a href="{% url 'email-mentor-intern-selection-reminder' round_slug=current_round.slug %}" class="btn btn-success">Mentor Intern Selection Email</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
<li>Send the email after {{ due }}.</li>
</ul>
</p>

<p><a href="{% url 'email-midpoint-feedback-instructions' round_slug=current_round.slug %}" class="btn btn-success">Midpoint Feedback Reminder</a></p>
21 changes: 3 additions & 18 deletions home/templates/home/dashboard/round_events.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
<h1>Email Reminders</h1>

{% for event in section.events %}
{% with until=event.due|add:event.duration %}
<h4>{{ event.due }}
{% if event.duration %}
until {{ until }}
{% endif %}
-
<h4>{{ event.due }} -
{% if section.today == event.due %}
today!
{% elif section.today > event.due %}
passed: {{ event.due|timesince:section.today }} ago
{% else %}
{{ event.due|timeuntil:section.today }} from now
{% endif %}
{% if event.duration %}
until
{% if section.today == until %}
today!
{% elif section.today > until %}
passed: {{ until|timesince:section.today }} ago
{% else %}
{{ until|timeuntil:section.today }} from now
{% endif %}
{% endif %}
</h4>
{% include event.template with current_round=event.current_round due=event.due only %}
{% include event.kind.dashboard_snippet with current_round=event.current_round due=event.due only %}
<p><a href="{% url event.kind.url_name round_slug=event.current_round.slug %}" class="btn btn-success">{{ event.kind.description }}</a></p>
{% if not forloop.last %}<hr>{% endif %}
{% endwith %}
{% endfor %}
4 changes: 2 additions & 2 deletions home/templates/home/send_email_preview.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% block title %}
Send reminder emails
Send {{ view.description }}
{% endblock %}

{% block content %}
Expand All @@ -21,6 +21,6 @@

<form action="" method="post">
{% csrf_token %}
<input class="btn btn-success" type="submit" value="Confirm" />
<input class="btn btn-success" type="submit" value="Send {{ view.description }}" />
</form>
{% endblock %}
17 changes: 9 additions & 8 deletions home/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,21 @@ def testEachVisitorType(self):
"/initial-feedback-summary/",
"/midpoint-feedback-export/",
"/midpoint-feedback-summary/",
"/email/application-deadline-review/",
"/email/application-period-ended/",
"/email/application-deadline-reminder/",
"/email/contributor-deadline-reminder/",
"/email/deadline-review/",
"/email/mentor-application-deadline-reminder/",
"/email/mentor-intern-selection-reminder/",
"/email/coordinator-intern-selection-reminder/",
"/email/deadline-reminder/",
"/email/application-period-ended/",
"/email/contributor-deadline-reminder/",
"/email/intern-welcome/",
"/email/internship-week-one/",
"/email/internship-week-three/",
"/email/internship-week-five/",
"/email/internship-week-seven/",
"/email/internship-week-1/",
"/email/internship-week-3/",
"/email/internship-week-5/",
"/email/internship-week-7/",
"/email/initial-feedback-instructions/",
"/email/midpoint-feedback-instructions/",
"/email/final-feedback-instructions/",
] + include("/communities/{}".format(community.slug), round_community_paths)

paths = sum((
Expand Down
17 changes: 4 additions & 13 deletions home/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import views
from . import dashboard, views
from .models import ApprovalStatus

from django.views.generic import TemplateView
Expand Down Expand Up @@ -61,18 +61,9 @@
url(r'^midpoint-feedback-summary/$', views.midpoint_feedback_summary, name='midpoint-feedback-summary'),
url(r'^final-feedback-export/$', views.final_mentor_feedback_export_view, name='final-feedback-export'),
url(r'^final-feedback-summary/$', views.final_feedback_summary, name='final-feedback-summary'),
url(r'^email/application-deadline-review/$', views.MentorCheckDeadlinesReminder.as_view(), name='email-deadline-review'),
url(r'^email/application-period-ended/$', views.ContributorsApplicationPeriodEndedReminder.as_view(), name='email-application-period-ended'),
url(r'^email/application-deadline-reminder/$', views.ApplicantsDeadlinesReminder.as_view(), name='email-deadline-reminder'),
url(r'^email/contributor-deadline-reminder/$', views.ContributorsDeadlinesReminder.as_view(), name='email-contributor-deadline-reminder'),
url(r'^email/mentor-application-deadline-reminder/$', views.MentorApplicationDeadlinesReminder.as_view(), name='email-mentor-application-deadline-reminder'),
url(r'^email/mentor-intern-selection-reminder/$', views.MentorInternSelectionReminder.as_view(), name='email-mentor-intern-selection-reminder'),
url(r'^email/coordinator-intern-selection-reminder/$', views.CoordinatorInternSelectionReminder.as_view(), name='email-coordinator-intern-selection-reminder'),
url(r'^email/intern-welcome/$', views.InternNotification.as_view(), name='email-intern-welcome'),
url(r'^email/internship-week-(?P<week>[^/]+)/$', views.InternWeek.as_view(), name='email-internship-week'),
url(r'^email/initial-feedback-instructions/$', views.InitialFeedbackInstructions.as_view(), name='email-initial-feedback-instructions'),
url(r'^email/midpoint-feedback-instructions/$', views.MidpointFeedbackInstructions.as_view(), name='email-midpoint-feedback-instructions'),
url(r'^email/final-feedback-instructions/$', views.FinalFeedbackInstructions.as_view(), name='email-final-feedback-instructions'),
] + [
url(r'^email/{}/$'.format(event.slug), event.as_view(), name=event.url_name())
for event in dashboard.all_round_events
]

urlpatterns = [
Expand Down
Loading

0 comments on commit c9fa417

Please sign in to comment.