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

feat: added ORA graded by staff notification #35389

Merged
merged 7 commits into from
Sep 19, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions openedx/core/djangoapps/notifications/base_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,26 @@
'filters': [FILTER_AUDIT_EXPIRED_USERS_WITH_NO_ROLE],
'visible_to': [CourseStaffRole.ROLE, CourseInstructorRole.ROLE]
},
'ora_grade_assigned': {
'notification_app': 'grading',
'name': 'ora_grade_assigned',
'is_core': False,
'info': '',
'web': False,
'email': False,
'push': False,
'email_cadence': EmailCadence.DAILY,
'non_editable': [],
'content_template': _('<{p}>You have received {points_earned} out of {points_possible} on your assessment: '
'<{strong}>{ora_name}</{strong}></{p}>'),
'content_context': {
'ora_name': 'Name of ORA in course',
'points_earned': 'Points earned',
'points_possible': 'Points possible',
},
'email_template': '',
'filters': [FILTER_AUDIT_EXPIRED_USERS_WITH_NO_ROLE],
},
}

COURSE_NOTIFICATION_APPS = {
Expand Down
10 changes: 10 additions & 0 deletions openedx/core/djangoapps/notifications/config/waffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@
# .. toggle_warning: When the flag is ON, Email Notifications feature is enabled.
# .. toggle_tickets: INF-1259
ENABLE_EMAIL_NOTIFICATIONS = WaffleFlag(f'{WAFFLE_NAMESPACE}.enable_email_notifications', __name__)

# .. toggle_name: notifications.enable_ora_grade_notifications
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
# .. toggle_description: Waffle flag to enable ORA grade notifications
# .. toggle_use_cases: temporary, open_edx
# .. toggle_creation_date: 2024-09-10
# .. toggle_target_removal_date: 2024-10-10
# .. toggle_tickets: INF-1304
ENABLE_ORA_GRADE_NOTIFICATION = CourseWaffleFlag(f"{WAFFLE_NAMESPACE}.enable_ora_grade_notifications", __name__)
8 changes: 7 additions & 1 deletion openedx/core/djangoapps/notifications/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
ForumRoleAudienceFilter,
TeamAudienceFilter
)
from openedx.core.djangoapps.notifications.config.waffle import ENABLE_NOTIFICATIONS
from openedx.core.djangoapps.notifications.config.waffle import ENABLE_NOTIFICATIONS, ENABLE_ORA_GRADE_NOTIFICATION
from openedx.core.djangoapps.notifications.models import CourseNotificationPreference

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -72,6 +72,12 @@ def generate_user_notifications(signal, sender, notification_data, metadata, **k
"""
Watches for USER_NOTIFICATION_REQUESTED signal and calls send_web_notifications task
"""
if (
notification_data.notification_type == 'ora_grade_assigned'
and not ENABLE_ORA_GRADE_NOTIFICATION.is_enabled(notification_data.course_key)
):
return

from openedx.core.djangoapps.notifications.tasks import send_notifications
notification_data = notification_data.__dict__
notification_data['course_key'] = str(notification_data['course_key'])
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ADDITIONAL_NOTIFICATION_CHANNEL_SETTINGS = ['email_cadence']

# Update this version when there is a change to any course specific notification type or app.
COURSE_NOTIFICATION_CONFIG_VERSION = 11
COURSE_NOTIFICATION_CONFIG_VERSION = 12


def get_course_notification_preference_config():
Expand Down
9 changes: 8 additions & 1 deletion openedx/core/djangoapps/notifications/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,14 @@ def _expected_api_response(self, course=None):
'push': True,
'email_cadence': 'Daily',
'info': 'Notifications for submission grading.'
}
},
'ora_grade_assigned': {
'web': False,
'email': False,
'push': False,
'email_cadence': 'Daily',
'info': ''
},
},
'non_editable': {}
}
Expand Down
Loading