Skip to content

Commit

Permalink
Merge pull request learningequality#349 from rtibbles/practice_quiz_node
Browse files Browse the repository at this point in the history
Add PracticeQuizNode.
  • Loading branch information
rtibbles authored Dec 13, 2021
2 parents 54dab5b + f869ef4 commit 91f803d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ricecooker/classes/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ class CustomNavigationNode(ContentNode):
def __init__(self, *args, **kwargs):
kwargs["extra_fields"] = kwargs.get("extra_fields", {})
kwargs["extra_fields"]["options"] = kwargs["extra_fields"].get("options", {})
# TODO: update le-utils version and use a constant value here
kwargs["extra_fields"]["options"].update({'modality': "CUSTOM_NAVIGATION"})
super(CustomNavigationNode, self).__init__(*args, **kwargs)

Expand Down Expand Up @@ -1105,6 +1106,7 @@ class CustomNavigationChannelNode(ChannelNode):
def __init__(self, *args, **kwargs):
kwargs["extra_fields"] = kwargs.get("extra_fields", {})
kwargs["extra_fields"]["options"] = kwargs["extra_fields"].get("options", {})
# TODO: update le-utils version and use a constant value here
kwargs["extra_fields"]["options"].update({'modality': "CUSTOM_NAVIGATION"})
super(CustomNavigationChannelNode, self).__init__(*args, **kwargs)

Expand All @@ -1120,3 +1122,16 @@ def validate(self):
return super(CustomNavigationChannelNode, self).validate()
except AssertionError as ae:
raise InvalidNodeException("Invalid node ({}): {} - {}".format(ae.args[0], self.title, self.__dict__))


class PracticeQuizNode(ExerciseNode):
"""
Node class for creating Practice Quizzes that are exercises under the hood but
are displayed as Practice Quizzes in Kolibri.
"""
def __init__(self, *args, **kwargs):
kwargs["exercise_data"] = kwargs.get("exercise_data", {})
kwargs["exercise_data"]["options"] = kwargs["exercise_data"].get("options", {})
# TODO: update le-utils version and use a constant value here
kwargs["exercise_data"]["options"].update({'modality': "QUIZ"})
super(PracticeQuizNode, self).__init__(*args, **kwargs)

0 comments on commit 91f803d

Please sign in to comment.