From 881e137fb0b80e246e57ed25a1e91cf47133c136 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 12:23:24 -0400 Subject: [PATCH 1/9] Save lcp state when a problem is saved --- common/lib/xmodule/xmodule/capa_module.py | 2 ++ jenkins/quality.sh | 16 ---------------- 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100755 jenkins/quality.sh diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 9829555134..7786f607c4 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -734,6 +734,8 @@ class CapaModule(XModule): self.lcp.student_answers = answers + self.set_state_from_lcp() + self.system.track_function('save_problem_success', event_info) msg = "Your answers have been saved" if not self.max_attempts==0: diff --git a/jenkins/quality.sh b/jenkins/quality.sh deleted file mode 100755 index 56217af874..0000000000 --- a/jenkins/quality.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash - -set -e -set -x - -git remote prune origin - -# Reset the submodule, in case it changed -git submodule foreach 'git reset --hard HEAD' - -# Set the IO encoding to UTF-8 so that askbot will start -export PYTHONIOENCODING=UTF-8 - -rake clobber -rake pep8 || echo "pep8 failed, continuing" -rake pylint || echo "pylint failed, continuing" From 7b5427006ce931d1d07406998bfd053e543161ca Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 12:25:45 -0400 Subject: [PATCH 2/9] Save lcp state on initialization (for seed initialization) --- common/lib/xmodule/xmodule/capa_module.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 7786f607c4..f457891525 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -168,6 +168,8 @@ class CapaModule(XModule): # add extra info and raise raise Exception(msg), None, sys.exc_info()[2] + self.set_state_from_lcp() + def new_lcp(self, state, text=None): if text is None: text = self.data From c1dbd985260178f54934043e5d5e0532a0fb3fd8 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 13:07:28 -0400 Subject: [PATCH 3/9] Fix bad reference to item_location --- cms/djangoapps/contentstore/module_info_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/module_info_model.py b/cms/djangoapps/contentstore/module_info_model.py index 2282333eb0..d866156f03 100644 --- a/cms/djangoapps/contentstore/module_info_model.py +++ b/cms/djangoapps/contentstore/module_info_model.py @@ -90,4 +90,4 @@ def set_module_info(store, location, post_data): # commit to datastore # TODO (cpennington): This really shouldn't have to do this much reaching in to get the metadata - store.update_metadata(item_location, module._model_data._kvs._metadata) + store.update_metadata(location, module._model_data._kvs._metadata) From a9431176082f1b7f0cfd153324f76f79d11c9337 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 13:42:07 -0400 Subject: [PATCH 4/9] Log ErrorDescriptor creation as a warning --- common/lib/xmodule/xmodule/modulestore/mongo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/mongo.py b/common/lib/xmodule/xmodule/modulestore/mongo.py index 00abad27ac..f1f4d43eb5 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo.py @@ -165,7 +165,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem): inherit_metadata(module, metadata_to_inherit) return module except: - log.debug("Failed to load descriptor", exc_info=True) + log.warning("Failed to load descriptor", exc_info=True) return ErrorDescriptor.from_json( json_data, self, From 7e1349775cfb8d80526d7c1c217c1e99e572e8bc Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 13:53:59 -0400 Subject: [PATCH 5/9] Don't write data to metadata when updating course grading --- cms/djangoapps/models/settings/course_grading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/models/settings/course_grading.py b/cms/djangoapps/models/settings/course_grading.py index ca3a72c3db..36f5e4cb97 100644 --- a/cms/djangoapps/models/settings/course_grading.py +++ b/cms/djangoapps/models/settings/course_grading.py @@ -231,7 +231,7 @@ class CourseGradingModel(object): del descriptor.lms.format del descriptor.lms.graded - get_modulestore(location).update_metadata(location, descriptor._model_data._kvs._data) + get_modulestore(location).update_metadata(location, descriptor._model_data._kvs._metadata) @staticmethod From 07059d0dfc5c0d20cd00fb84dbfa0a2bc254416a Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 14:32:56 -0400 Subject: [PATCH 6/9] Iterate over metadata items when setting module info --- cms/djangoapps/contentstore/module_info_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/module_info_model.py b/cms/djangoapps/contentstore/module_info_model.py index d866156f03..8ea6add88d 100644 --- a/cms/djangoapps/contentstore/module_info_model.py +++ b/cms/djangoapps/contentstore/module_info_model.py @@ -74,7 +74,7 @@ def set_module_info(store, location, post_data): # update existing metadata with submitted metadata (which can be partial) # IMPORTANT NOTE: if the client passed pack 'null' (None) for a piece of metadata that means 'remove it' - for metadata_key in posted_metadata.keys(): + for metadata_key, value in posted_metadata.items(): # let's strip out any metadata fields from the postback which have been identified as system metadata # and therefore should not be user-editable, so we should accept them back from the client From de46666a7f9df5c388f788c02dad3e47e7d412f3 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 14:38:16 -0400 Subject: [PATCH 7/9] Use .get to avoid key errors during inheritance --- common/lib/xmodule/xmodule/modulestore/inheritance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/inheritance.py b/common/lib/xmodule/xmodule/modulestore/inheritance.py index 947c6a2985..d819abe367 100644 --- a/common/lib/xmodule/xmodule/modulestore/inheritance.py +++ b/common/lib/xmodule/xmodule/modulestore/inheritance.py @@ -52,7 +52,7 @@ def own_metadata(module): if field.scope != Scope.settings: continue - if field.name in inherited_metadata and module._model_data[field.name] == inherited_metadata[field.name]: + if field.name in inherited_metadata and module._model_data.get(field.name) == inherited_metadata.get(field.name): continue if field.name not in module._model_data: From 4cea094f70a17ab73a2680b77a61732dc6f7779e Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 15:29:58 -0400 Subject: [PATCH 8/9] Be a little more liberal with what count's as not having a due date in a section --- cms/templates/edit_subsection.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/templates/edit_subsection.html b/cms/templates/edit_subsection.html index 6ad50e5598..68e9d2f8e4 100644 --- a/cms/templates/edit_subsection.html +++ b/cms/templates/edit_subsection.html @@ -80,7 +80,7 @@

<% # due date uses it own formatting for stringifying the date. As with capa_module.py, there's a utility module available for us to use - due_date = dateutil.parser.parse(subsection.lms.due) if subsection.lms.due is not None else None + due_date = dateutil.parser.parse(subsection.lms.due) if subsection.lms.due else None %> From a39d607a8d2ca051dac5bcd1cef7ea6e8cd7c5a0 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 11 Mar 2013 15:41:59 -0400 Subject: [PATCH 9/9] Make default course grading weights integers, to minimize floating point variation --- common/lib/xmodule/xmodule/course_module.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index fd626b103a..55e041e8f6 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -256,27 +256,27 @@ class CourseDescriptor(SequenceDescriptor): "min_count": 12, "drop_count": 2, "short_label": "HW", - "weight": 0.15 + "weight": 15 }, { "type": "Lab", "min_count": 12, "drop_count": 2, - "weight": 0.15 + "weight": 15 }, { "type": "Midterm Exam", "short_label": "Midterm", "min_count": 1, "drop_count": 0, - "weight": 0.3 + "weight": 30 }, { "type": "Final Exam", "short_label": "Final", "min_count": 1, "drop_count": 0, - "weight": 0.4 + "weight": 40 } ], "GRADE_CUTOFFS": {