From bf4f946f0d3a9b53b972ac6e065de1e6d10bb5d5 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Wed, 27 Jun 2012 14:47:16 -0400 Subject: [PATCH 1/4] Put in a fix for the Profile page (a bug was showing up for new users). A basecamp discussion will be started on the issue. --- lms/djangoapps/courseware/grades.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/courseware/grades.py b/lms/djangoapps/courseware/grades.py index 4a11ec2d51..00bdffb697 100644 --- a/lms/djangoapps/courseware/grades.py +++ b/lms/djangoapps/courseware/grades.py @@ -176,11 +176,13 @@ def get_score(user, problem, cache, coursename=None): ## HACK 2: Backwards-compatibility: This should be written when a grade is saved, and removed from the system # TODO: These are no longer correct params for I4xSystem -- figure out what this code # does, clean it up. - from module_render import I4xSystem - system = I4xSystem(None, None, None, coursename=coursename) - total=float(xmodule.capa_module.Module(system, etree.tostring(problem), "id").max_score()) - response.max_grade = total - response.save() + # from module_render import I4xSystem + # system = I4xSystem(None, None, None, coursename=coursename) + # total=float(xmodule.capa_module.Module(system, etree.tostring(problem), "id").max_score()) + # response.max_grade = total + # response.save() + total = 1 + # For a temporary fix, we just assume a problem is worth 1 point if we haven't seen it before. This is totally incorrect #Now we re-weight the problem, if specified weight = problem.get("weight", None) From 2fde7f4c6d7d18f36cee610b3fa761140564781d Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 28 Jun 2012 08:39:12 -0400 Subject: [PATCH 2/4] Minor fixes from pull request 131 --- common/lib/mitxmako/shortcuts.py | 2 +- lms/djangoapps/courseware/content_parser.py | 2 +- lms/djangoapps/courseware/management/commands/check_course.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/lib/mitxmako/shortcuts.py b/common/lib/mitxmako/shortcuts.py index 72a9b81e3c..c601d93260 100644 --- a/common/lib/mitxmako/shortcuts.py +++ b/common/lib/mitxmako/shortcuts.py @@ -14,7 +14,7 @@ import logging -log = logging.getLogger("mitx.common.lib.mitxmako") +log = logging.getLogger("mitx." + __name__) from django.template import Context from django.http import HttpResponse diff --git a/lms/djangoapps/courseware/content_parser.py b/lms/djangoapps/courseware/content_parser.py index 62163c86b0..95c3afed8c 100644 --- a/lms/djangoapps/courseware/content_parser.py +++ b/lms/djangoapps/courseware/content_parser.py @@ -223,7 +223,7 @@ def get_module(tree, module, id_tag, module_id, sections_dirname, options): result_set = tree.xpath(xpath_search) if len(result_set) < 1: # Not found in main tree. Let's look in the section files. - section_list = (s[:-4] for s in os.listdir(sections_dirname) if s[-4:]=='.xml') + section_list = (s[:-4] for s in os.listdir(sections_dirname) if s.endswith('.xml')) for section in section_list: try: s = get_section(section, options, sections_dirname) diff --git a/lms/djangoapps/courseware/management/commands/check_course.py b/lms/djangoapps/courseware/management/commands/check_course.py index 8de29bdd8b..8af0c5d4be 100644 --- a/lms/djangoapps/courseware/management/commands/check_course.py +++ b/lms/djangoapps/courseware/management/commands/check_course.py @@ -15,7 +15,7 @@ middleware.MakoMiddleware() def check_names(user, course): ''' - Complain if any problems have alphanumeric names. + Complain if any problems have non alphanumeric names. TODO (vshnayder): there are some in 6.002x that don't. Is that actually a problem? ''' all_ok = True From 919f8cf261de85b14c21917fbb0c853e562dea7b Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 28 Jun 2012 11:28:42 -0400 Subject: [PATCH 3/4] Import x_module using the full path --- cms/envs/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index fc721ca820..ddaeaa66b3 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -157,7 +157,7 @@ PIPELINE_CSS = { PIPELINE_ALWAYS_RECOMPILE = ['sass/base-style.scss'] -from x_module import XModuleDescriptor +from xmodule.x_module import XModuleDescriptor js_file_dir = PROJECT_ROOT / "static" / "coffee" / "module" try: os.makedirs(js_file_dir) From 19044abed293a29351e7a1928b4d4f8354fcd880 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 28 Jun 2012 11:29:46 -0400 Subject: [PATCH 4/4] Run tests before running code quality checks (for faster turnaround time) --- rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakefile b/rakefile index b6fbb18ac6..e76e200777 100644 --- a/rakefile +++ b/rakefile @@ -39,7 +39,7 @@ def django_admin(system, env, command, *args) return "#{django_admin} #{command} --settings=#{system}.envs.#{env} --pythonpath=. #{args.join(' ')}" end -task :default => [:pep8, :pylint, :test] +task :default => [:test, :pep8, :pylint] directory REPORT_DIR directory LMS_REPORT_DIR