From a44eacd474ad938b5754641f3e7ca7fa7b63d6d7 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Wed, 22 May 2013 10:54:52 -0400 Subject: [PATCH] Make fields stringy, remove false dict --- .../xmodule/combined_open_ended_module.py | 16 ++++++++-------- lms/djangoapps/open_ended_grading/views.py | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/common/lib/xmodule/xmodule/combined_open_ended_module.py b/common/lib/xmodule/xmodule/combined_open_ended_module.py index f4074283fe..a2ce4d0a65 100644 --- a/common/lib/xmodule/xmodule/combined_open_ended_module.py +++ b/common/lib/xmodule/xmodule/combined_open_ended_module.py @@ -8,7 +8,7 @@ from .x_module import XModule from xblock.core import Integer, Scope, String, Boolean, List from xmodule.open_ended_grading_classes.combined_open_ended_modulev1 import CombinedOpenEndedV1Module, CombinedOpenEndedV1Descriptor from collections import namedtuple -from .fields import Date, StringyFloat +from .fields import Date, StringyFloat, StringyInteger, StringyBoolean log = logging.getLogger("mitx.courseware") @@ -49,19 +49,19 @@ 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) + current_task_number = StringyInteger(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", scope=Scope.user_state) - student_attempts = Integer(help="Number of attempts taken by the student on this problem", default=0, + student_attempts = StringyInteger(help="Number of attempts taken by the student on this problem", default=0, scope=Scope.user_state) - ready_to_reset = Boolean(help="If the problem is ready to be reset or not.", default=False, + ready_to_reset = StringyBoolean(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, + attempts = StringyInteger(help="Maximum number of attempts that a student is allowed.", default=1, scope=Scope.settings) + is_graded = StringyBoolean(help="Whether or not the problem is graded.", default=False, scope=Scope.settings) + accept_file_upload = StringyBoolean(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, + skip_spelling_checks = StringyBoolean(help="Whether or not to skip initial spelling checks.", default=True, scope=Scope.settings) 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, diff --git a/lms/djangoapps/open_ended_grading/views.py b/lms/djangoapps/open_ended_grading/views.py index f989d92902..e6da717067 100644 --- a/lms/djangoapps/open_ended_grading/views.py +++ b/lms/djangoapps/open_ended_grading/views.py @@ -103,13 +103,12 @@ def find_peer_grading_module(course): #Get the course id and split it course_id_parts = course.id.split("/") - false_dict = [False, "False", "false", "FALSE"] #TODO: This will not work with multiple runs of a course. Make it work. The last key in the Location passed #to get_items is called revision. Is this the same as run? #Get the peer grading modules currently in the course items = modulestore().get_items(['i4x', None, course_id_parts[1], 'peergrading', None]) #See if any of the modules are centralized modules (ie display info from multiple problems) - items = [i for i in items if getattr(i,"use_for_single_location", True) in false_dict] + items = [i for i in items if not getattr(i,"use_for_single_location", True)] #Get the first one if len(items)>0: item_location = items[0].location