-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: welcome emails for xPRO Learners #3017
Changes from all commits
fb9ee8b
7f32509
38e5dc6
7ba0e97
c88ee5a
d31c9d0
dd6bf87
e032963
8079eb4
f559cb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
"""Utility functions for ecommerce""" | ||
|
||
import datetime | ||
import logging | ||
from urllib.parse import urlencode, urljoin | ||
|
||
|
@@ -12,6 +13,7 @@ | |
from ecommerce.exceptions import ParseException | ||
|
||
log = logging.getLogger(__name__) | ||
EMAIL_TIME_FORMAT = "%I:%M %p %Z" | ||
|
||
|
||
def create_delete_rule(table_name): | ||
|
@@ -154,3 +156,23 @@ def is_existing_coupon_code(value): | |
Coupon.objects.filter(coupon_code=value).exists() | ||
or B2BCoupon.objects.filter(coupon_code=value).exists() | ||
) | ||
|
||
|
||
def format_run_date(run_date): | ||
""" | ||
Format run date to return both date and time strings. | ||
|
||
Args: | ||
run_date (datetime): The datetime to format. | ||
|
||
Returns: | ||
tuple: A tuple containing the formatted date and time strings. | ||
""" | ||
if run_date: | ||
from ecommerce.mail_api import EMAIL_DATE_FORMAT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use import here to avoid circular import |
||
|
||
formatted_date_time = run_date.astimezone(datetime.timezone.utc).strftime( | ||
f"{EMAIL_DATE_FORMAT}-{EMAIL_TIME_FORMAT}" | ||
) | ||
return tuple(formatted_date_time.split("-", 1)) | ||
return "", "" |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,145 @@ | ||||||
{% extends "email_base.html" %} | ||||||
|
||||||
{% block content %} | ||||||
<!-- 1 Column Text + Button : BEGIN --> | ||||||
<tr> | ||||||
<td style="background-color: #ffffff"> | ||||||
<table | ||||||
role="presentation" | ||||||
cellspacing="0" | ||||||
cellpadding="0" | ||||||
border="0" | ||||||
width="100%" | ||||||
> | ||||||
<tr> | ||||||
<td | ||||||
style=" | ||||||
padding: 20px; | ||||||
font-family: sans-serif; | ||||||
font-size: 15px; | ||||||
line-height: 20px; | ||||||
color: #555555; | ||||||
" | ||||||
> | ||||||
<p style="margin: 0 0 10px"> | ||||||
Dear | ||||||
{{ user.name }}, | ||||||
</p> | ||||||
<p style="margin: 0 0 10px 50px">Welcome to MIT xPRO!</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
We're thrilled to have you on board for our upcoming course, | ||||||
<strong>{{ enrollment.run }}</strong>. This is a significant step | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any specific reason, you used run instead of course?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used |
||||||
toward advancing your expertise. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong>Here are some vital details about your course:</strong> | ||||||
</p> | ||||||
<ul style="margin: 0 0 10px; padding-left: 20px"> | ||||||
<li> | ||||||
Course Name: <strong>{{ enrollment.run }}</strong> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
</li> | ||||||
{% if run_start_date %} | ||||||
<li> | ||||||
Start Date: <strong>{{ run_start_date }}</strong> | ||||||
</li> | ||||||
{% endif %} | ||||||
{% if run_date_range %} | ||||||
<li> | ||||||
Duration: <strong>{{ run_date_range }}</strong> | ||||||
</li> | ||||||
{% endif %} | ||||||
{% if run_start_time %} | ||||||
<li> | ||||||
Start Time: <strong>{{ run_start_time }}</strong> | ||||||
</li> | ||||||
{% endif %} | ||||||
</ul> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong><u>Course Format:</u></strong | ||||||
><br /> | ||||||
All MIT xPRO courses are delivered online for maximum flexibility. | ||||||
The course content, including pre-recorded video lectures, is | ||||||
accessible at your convenience, with no specific log-on times. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong><u>Accessing Your Course:</u></strong | ||||||
><br /> | ||||||
Once you have enrolled in a course or program with MIT xPRO, you can | ||||||
expect to gain access to the course materials and platform on the | ||||||
scheduled start date. You will not be able to access any of the | ||||||
course content before the start date and time. To log in and start | ||||||
your course, visit your MIT xPRO account dashboard. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong><u>In-Course Support:</u></strong | ||||||
><br /> | ||||||
Each course offers in-course discussion forums, allowing you to | ||||||
engage with fellow learners and receive support. Our dedicated | ||||||
course assistant (CA) team actively monitors these forums to offer | ||||||
assistance and guidance. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong><u>Course Schedule and Deadlines:</u></strong | ||||||
><br /> | ||||||
Please be aware that each MIT xPRO course has its own schedule, with | ||||||
content becoming available after the course start date. Content | ||||||
releases typically adhere to a schedule determined by the course | ||||||
instructors, often on a weekly basis. Assignment deadlines are | ||||||
strictly enforced, and late submissions are not accepted. The course | ||||||
will conclude on a designated end date, at which point live aspects | ||||||
such as discussion forums will be closed. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong><u>Certificate of Completion:</u></strong | ||||||
><br /> | ||||||
Upon successfully completing the course, you'll receive a digital | ||||||
Professional Certificate from MIT xPRO, validating your | ||||||
accomplishment and expertise in | ||||||
<strong>{{ enrollment.run }}</strong>. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong><u>Where to Seek Support:</u></strong | ||||||
><br /> | ||||||
For inquiries related to in-course content, we recommend reaching | ||||||
out directly to the course team. They possess the expertise and have | ||||||
access to the course materials, making them best equipped to provide | ||||||
accurate and detailed responses. You can find the contact | ||||||
information for the course team within the courseware itself, | ||||||
typically in sections such as the Syllabus, Course Guide, or FAQ. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
For non-sensitive course assignment questions, posting them in the | ||||||
in-course discussion forums is another valuable option. Our course | ||||||
assistants (CAs) actively monitor these forums, and fellow learners | ||||||
often contribute their insights and solutions. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
For general inquiries not specific to course content, our xPRO | ||||||
Support Team is here to assist you. Feel free to check out the | ||||||
<a href="https://xpro.zendesk.com/hc/en-us">MIT xPRO Help Center</a> | ||||||
or reach out to us at | ||||||
<a href="mailto:[email protected]">[email protected]</a>, and | ||||||
we'll be happy to help. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
We look forward to supporting you during your time with MIT xPRO. If | ||||||
you have any further questions or need assistance, please do not | ||||||
hesitate to reach out. | ||||||
</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
Get ready to unlock your potential and excel! | ||||||
</p> | ||||||
<p style="margin: 0 0 10px">Best of luck with your studies,</p> | ||||||
<p style="margin: 0 0 10px">MIT xPRO Team</p> | ||||||
<p style="margin: 0 0 10px"> | ||||||
<strong>P.S.</strong> Don't forget to check out the "Getting | ||||||
Started" section in your course dashboard for helpful tips and | ||||||
resources to kick-start your learning experience! | ||||||
</p> | ||||||
</td> | ||||||
</tr> | ||||||
</table> | ||||||
</td> | ||||||
</tr> | ||||||
<!-- 1 Column Text + Button : END --> | ||||||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Welcome! {{ enrollment.run }} starts on {{ run_start_date }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature flags are more readable when applied to the initiation of something. In this case, the flag should be placed where we are calling
send_course_run_enrollment_welcome_email
from. Someone looking at the code in api.py might think that the email would be sent but that would be blocked in this function. So, If we take this flag to the api.py before calling this function that would make more sense for code reader.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s a good suggestion, but we will need to make this change in both places. Actually, I tried to make this change in a common place as it is being called not only through api.py but also through
courses/management/utils.py
for transfer enrollment.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, Let's keep it here then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I was looking into addressing your request, and I pushed commit as didn't notice we were agreed upon.
I have reverted it. Now It seems we are good and ready to go to merge.