Skip to content
Snippets Groups Projects
Unverified Commit c0c1279b authored by Dillon Dumesnil's avatar Dillon Dumesnil Committed by GitHub
Browse files

Merge pull request #24684 from edx/ddumesnil/fix-enabled-show-answer

Fix for enabled_for to not assume the self_paced attr exists
parents c69fb5b2 f5c893e3
No related branches found
Tags release-2020-08-04-16.09
No related merge requests found
......@@ -34,7 +34,7 @@ class ShowAnswerFieldOverride(FieldOverrideProvider):
# SHOWANSWER.FINISHED is left on a Course. In that case, we continue
# to follow the same mapping of FINISHED -> AFTER_ALL_ATTEMPTS_OR_CORRECT.
# This value will then be inherited throughout the rest of the Course.
if not has_showanswer and block.category == 'course':
if not has_showanswer and block and block.category == 'course':
return SHOWANSWER.AFTER_ALL_ATTEMPTS_OR_CORRECT
elif not has_showanswer:
return default
......@@ -53,4 +53,4 @@ class ShowAnswerFieldOverride(FieldOverrideProvider):
@classmethod
def enabled_for(cls, course):
""" Enabled only for Self-Paced courses using Personalized User Schedules. """
return course.self_paced and RELATIVE_DATES_FLAG.is_enabled(course.id)
return course and course.self_paced and RELATIVE_DATES_FLAG.is_enabled(course.id)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment