forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add cronjob for sending progress emails to users
- Loading branch information
Muhammad Faraz Maqsood
authored and
Muhammad Faraz Maqsood
committed
Feb 19, 2024
1 parent
cec09bf
commit fb83bb7
Showing
13 changed files
with
269 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
""" | ||
Admin Models | ||
""" | ||
""" | ||
Django Admin page for SurveyReport. | ||
""" | ||
|
||
|
||
from django.contrib import admin | ||
from .models import CourseCompletionEmailHistory | ||
|
||
|
||
class CourseCompletionEmailHistoryAdmin(admin.ModelAdmin): | ||
""" | ||
Admin to manage Course Completion Email History. | ||
""" | ||
list_display = ( | ||
'id', 'user', 'course_key', 'last_progress_email_sent', | ||
) | ||
search_fields = ( | ||
'id', 'user__username', 'user__email', 'course_key', | ||
) | ||
|
||
admin.site.register(CourseCompletionEmailHistory, CourseCompletionEmailHistoryAdmin) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
openedx/features/sdaia_features/course_progress/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 3.2.20 on 2024-02-19 07:33 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import opaque_keys.edx.django.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CourseCompletionEmailHistory', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('course_key', opaque_keys.edx.django.models.CourseKeyField(db_index=True, max_length=255)), | ||
('last_progress_email_sent', models.IntegerField(default=0)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
Models | ||
""" | ||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user | ||
from django.db import models | ||
|
||
from opaque_keys.edx.django.models import CourseKeyField | ||
|
||
|
||
class CourseCompletionEmailHistory(models.Model): | ||
""" | ||
Keeps progress for a student for which he/she gets an email as he/she reaches at that particluar progress in a course. | ||
""" | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
course_key = CourseKeyField(max_length=255, db_index=True) | ||
last_progress_email_sent = models.IntegerField(default=0) |
21 changes: 21 additions & 0 deletions
21
openedx/features/sdaia_features/course_progress/templates/course_progress/base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
{% comment %} | ||
As the developer of this package, don't place anything here if you can help it | ||
since this allows developers to have interoperability between your template | ||
structure and their own. | ||
|
||
Example: Developer melding the 2SoD pattern to fit inside with another pattern:: | ||
|
||
{% extends "base.html" %} | ||
{% load static %} | ||
|
||
<!-- Their site uses old school block layout --> | ||
{% block extra_js %} | ||
|
||
<!-- Your package using 2SoD block layout --> | ||
{% block javascript %} | ||
<script src="{% static 'js/ninja.js' %}" type="text/javascript"></script> | ||
{% endblock javascript %} | ||
|
||
{% endblock extra_js %} | ||
{% endcomment %} |
26 changes: 26 additions & 0 deletions
26
...course_progress/templates/course_progress/edx_ace/usercourseprogressemail/email/body.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- {% extends 'ace_common/edx_ace/common/base_body.html' %} --> | ||
|
||
{% load i18n %} | ||
{% load static %} | ||
{% block content %} | ||
<p style="color: rgba(0,0,0,.75);"> | ||
{% autoescape off %} | ||
{# xss-lint: disable=django-blocktrans-missing-escape-filter #} | ||
{% blocktrans %}Hi there,{% endblocktrans %} | ||
{% endautoescape %} | ||
<br /> | ||
</p> | ||
<p style="color: rgba(0,0,0,.75);"> | ||
{% autoescape off %} | ||
{# xss-lint: disable=django-blocktrans-missing-escape-filter #} | ||
{% blocktrans %}Congrats on your progress! You're {{ current_progress }}% through the "{{ course_name }}". {% endblocktrans %} | ||
{% endautoescape %} | ||
</p> | ||
<p style="color: rgba(0,0,0,.75);"> | ||
{% autoescape off %} | ||
{# xss-lint: disable=django-blocktrans-missing-escape-filter #} | ||
{% blocktrans %}Keep it up! Continue your journey {% endblocktrans %}<a href="{{ course_home_url }}">here</a>. | ||
{% endautoescape %} | ||
<br /> | ||
</p> | ||
{% endblock %} |
7 changes: 7 additions & 0 deletions
7
.../course_progress/templates/course_progress/edx_ace/usercourseprogressemail/email/body.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% load i18n %}{% autoescape off %} | ||
{% blocktrans %}Hi there,{% endblocktrans %} | ||
{% blocktrans %}Congrats on your progress! You're {{ current_progress }}% through the "{{ course_name }}".{% endblocktrans %} | ||
{% blocktrans %}Keep it up! Continue your journey <a href="{{ course_home_url }}">here</a>.{% endblocktrans %} | ||
{% trans "Enjoy your studies," %} | ||
{% blocktrans %}The {{ platform_name }} Team {% endblocktrans %} | ||
{% endautoescape %} |
1 change: 1 addition & 0 deletions
1
...se_progress/templates/course_progress/edx_ace/usercourseprogressemail/email/from_name.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ platform_name }} |
1 change: 1 addition & 0 deletions
1
...course_progress/templates/course_progress/edx_ace/usercourseprogressemail/email/head.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- {% extends 'ace_common/edx_ace/common/base_head.html' %} --> |
4 changes: 4 additions & 0 deletions
4
...urse_progress/templates/course_progress/edx_ace/usercourseprogressemail/email/subject.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}{{ platform_name }} - {{ course_name }} | Course Progress 🚀 {% endblocktrans %} | ||
{% endautoescape %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters