Commit aaffee50 by cahrens

Initial cleanup of open_ended_module and peer_grading_module.

parent 2a8b8e20
......@@ -48,7 +48,6 @@ class VersionInteger(Integer):
class CombinedOpenEndedFields(object):
display_name = String(help="Display name for this module", default="Open Ended Grading", scope=Scope.settings)
current_task_number = Integer(help="Current task that the student is on.", default=0, scope=Scope.user_state)
task_states = List(help="List of state dictionaries of each task within this module.", scope=Scope.user_state)
state = String(help="Which step within the current task that the student is on.", default="initial",
......@@ -57,18 +56,26 @@ class CombinedOpenEndedFields(object):
scope=Scope.user_state)
ready_to_reset = Boolean(help="If the problem is ready to be reset or not.", default=False,
scope=Scope.user_state)
attempts = Integer(help="Maximum number of attempts that a student is allowed.", default=1, scope=Scope.settings)
is_graded = Boolean(help="Whether or not the problem is graded.", default=False, scope=Scope.settings)
accept_file_upload = Boolean(help="Whether or not the problem accepts file uploads.", default=False,
scope=Scope.settings)
skip_spelling_checks = Boolean(help="Whether or not to skip initial spelling checks.", default=True,
scope=Scope.settings)
attempts = Integer(display_name="Maximum Attempts",
help="Specifies the number of times the student can try to answer this problem.", default=1, scope=Scope.settings)
# TODO: move values to Boolean in xblock.
is_graded = Boolean(display_name="Graded", help="Whether or not the problem is graded.", default=False, scope=Scope.settings,
values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}])
accept_file_upload = Boolean(display_name="Accept File Upload",
help="If disabled, students cannot upload images to be graded with this problem.", default=False, scope=Scope.settings,
values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}])
skip_spelling_checks = Boolean(display_name="Basic Quality Filter",
# TODO: passing of text failed with "won't". Need to make our code more robust.
help="If enabled, submissions with poor spelling, short length, or poor grammar will not be peer reviewed.",
default=False, scope=Scope.settings, values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}])
due = Date(help="Date that this problem is due by", default=None, scope=Scope.settings)
graceperiod = String(help="Amount of time after the due date that submissions will be accepted", default=None,
scope=Scope.settings)
version = VersionInteger(help="Current version number", default=DEFAULT_VERSION, scope=Scope.settings)
data = String(help="XML data for the problem", scope=Scope.content)
weight = StringyFloat(help="How much to weight this problem by", scope=Scope.settings)
weight = StringyFloat(display_name="Problem Weight",
help="Specifies the number of points the problem is worth. By default, each response field in the problem is worth one point.",
scope=Scope.settings)
class CombinedOpenEndedModule(CombinedOpenEndedFields, XModule):
......@@ -221,3 +228,10 @@ class CombinedOpenEndedDescriptor(CombinedOpenEndedFields, RawDescriptor):
has_score = True
always_recalculate_grades = True
template_dir_name = "combinedopenended"
@property
def non_editable_metadata_fields(self):
non_editable_fields = super(CombinedOpenEndedDescriptor, self).non_editable_metadata_fields
non_editable_fields.extend([CombinedOpenEndedDescriptor.due, CombinedOpenEndedDescriptor.graceperiod,
CombinedOpenEndedDescriptor.version])
return non_editable_fields
......@@ -10,7 +10,7 @@ from .x_module import XModule
from xmodule.raw_module import RawDescriptor
from xmodule.modulestore.django import modulestore
from .timeinfo import TimeInfo
from xblock.core import Object, Integer, Boolean, String, Scope
from xblock.core import Object, String, Scope
from xmodule.fields import Date, StringyFloat, StringyInteger, StringyBoolean
from xmodule.open_ended_grading_classes.peer_grading_service import PeerGradingService, GradingServiceError, MockPeerGradingService
......@@ -32,14 +32,18 @@ class PeerGradingFields(object):
default=USE_FOR_SINGLE_LOCATION, scope=Scope.settings)
link_to_location = String(help="The location this problem is linked to.", default=LINK_TO_LOCATION,
scope=Scope.settings)
is_graded = StringyBoolean(help="Whether or not this module is scored.", default=IS_GRADED, scope=Scope.settings)
# TODO: move boolean default into xfields
is_graded = StringyBoolean(display_name="Graded", help="Whether or not this module is scored.", default=IS_GRADED,
values=[{'display_name': "True", "value": True}, {'display_name': "False", "value": False}], scope=Scope.settings)
due_date = Date(help="Due date that should be displayed.", default=None, scope=Scope.settings)
grace_period_string = String(help="Amount of grace to give on the due date.", default=None, scope=Scope.settings)
max_grade = StringyInteger(help="The maximum grade that a student can receieve for this problem.", default=MAX_SCORE,
scope=Scope.settings)
student_data_for_location = Object(help="Student data for a given peer grading problem.",
scope=Scope.user_state)
weight = StringyFloat(help="How much to weight this problem by", scope=Scope.settings)
weight = StringyFloat(display_name="Problem Weight",
help="Specifies the number of points the problem is worth. By default, each response field in the problem is worth one point.",
scope=Scope.settings)
class PeerGradingModule(PeerGradingFields, XModule):
......@@ -587,3 +591,12 @@ class PeerGradingDescriptor(PeerGradingFields, RawDescriptor):
has_score = True
always_recalculate_grades = True
template_dir_name = "peer_grading"
@property
def non_editable_metadata_fields(self):
non_editable_fields = super(PeerGradingDescriptor, self).non_editable_metadata_fields
non_editable_fields.extend([PeerGradingFields.due_date, PeerGradingFields.grace_period_string,
PeerGradingFields.link_to_location, PeerGradingFields.max_grade,
PeerGradingFields.use_for_single_location])
return non_editable_fields
---
metadata:
display_name: Open Ended Response
attempts: 1
is_graded: False
version: 1
skip_spelling_checks: False
accept_file_upload: False
weight: ""
data: |
<combinedopenended>
<rubric>
......
......@@ -5,7 +5,6 @@ metadata:
link_to_location: None
is_graded: False
max_grade: 1
weight: ""
data: |
<peergrading>
</peergrading>
......
......@@ -653,7 +653,7 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
for index, choice in enumerate(values):
json_choice = choice
# TODO: test this logic.
if 'value' in json_choice:
if hasattr(json_choice, 'value'):
json_choice['value'] = field.to_json(json_choice['value'])
else:
json_choice = field.to_json(json_choice)
......
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