Commit 07467a5b by Awais Jibran Committed by GitHub

Merge pull request #12989 from edx/aj/add-logging-for-allow-donation

Adding logging if course_id is not found in enrolled course modes.
parents 6e7d4cef dba8a51f
......@@ -826,6 +826,21 @@ def _allow_donation(course_modes, course_id, enrollment):
True if the course is allowing donations.
"""
if course_id not in course_modes:
flat_unexpired_modes = {
unicode(course_id): [mode for mode in modes]
for course_id, modes in course_modes.iteritems()
}
flat_all_modes = {
unicode(course_id): [mode.slug for mode in modes]
for course_id, modes in CourseMode.all_modes_for_courses([course_id]).iteritems()
}
log.error(
u'Can not find `%s` in course modes.`%s`. All modes: `%s`',
course_id,
flat_unexpired_modes,
flat_all_modes
)
donations_enabled = DonationConfiguration.current().enabled
return (
donations_enabled and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment